Been trying to create a random number generator that will generate numbers from [0,1] with a (relatively) uniform distribution. Currently, I have the following:
srand(time(NULL));
double r = (double)rand()/(double)RAND_MAX;
Yet, when printing, this does not seem to give me a random sequence. I've looked for solutions elsewhere, but this problem seems to arise when people forget to seed the rand() function.
Thanks for the help!
Aucun commentaire:
Enregistrer un commentaire