How to not get the same sequence of numbers back from rand() in C

1 Answer

0 votes
// Call srand to seed the pseudo-random number generator 
// with a random initial value, before call rand.

srand((unsigned int)time((time_t *)NULL));


// and include

#include <stdlib.h>
#include <time.h>

 



answered Jun 18, 2022 by avibootz
edited Jun 18, 2022 by avibootz
...