Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Generate a random number with C

Hi, i would like to know how to generate a random number by using C. I wrote the following code : srand(time(NULL)); int x = rand()%(4-1)+1; printf("%d", x); However, the generate...