Generating random numbers in C
- by moonstruckhorrors
While searching for Tutorials on generating random numbers in C I found This Topic
When I try to use the rand() function with parameters, I always get the random number generated 0.
When I try to use the rand() function with parameters, I always get the value 41.
And whenever I try to use arc4random() and random() functions, I get a LNK2019 error.
Here's what I'm doing:
#include <stdlib.h>
int main()
{
int x;
x = rand(6);
printf("%d", x);
}
This code always generate 41.
Where am I going wrong??
P.S. : I'm running Windows XP SP3 and using VS2010 Command Prompt as compiler.
P.P.S. : Took me 15 minutes to learn how to format properly.