Possible Duplicate:
why do i always get the same sequence of random numbers with rand() ?
This is my file so far:
#include <stdio.h>
int main(void) {
int y;
y = generateRandomNumber();
printf("\nThe number is: %d\n", y);
return 0;
}
int generateRandomNumber(void) {
int x;
x = rand();
return x;
}
My problem is rand() ALWAYS returns 41. I am using gcc on win... not sure what to do here.
EDIT: Using time to generate a random number won't work. It provides me a number (12000ish) and every time I call it is just a little higher (about +3 per second). This isn't the randomness I need. What do I do?