basic_rng.c
December 5, 2017 ยท View on GitHub
#include <stdio.h> #include <stdlib.h> #include <time.h>
int main(){ // use current time to seed the prng used by rand() // if srand is not called (default: srand(1)), rand() will always generate the same sequence srand(time(0)); for(int i=0; i<3; i++) printf("%d\n", rand()); return 0; }