I am using stdlib to generate random numbers, I know there are some better generators but stdlib is quite enough for me. I am doing.
while(condition){
sleep(1);
srand(time(NULL));
r=rand();
}
It is inside a loop so I need sleep(1) or the seed is the same and the number is repeated. The fact is that I need to generate thousands or maybe millions of numbers and if I wait 1 second per number it will take a long time. So there is another way independently of time to seed?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire