jeudi 21 février 2019

why does rand() give relatively close numbers?

I am using the rand() function in c++ yet i am getting very close numbers every time here is my code`

int pickrandom(){
  time_t t;
  time(&t);
  srand (t);
  return rand();
}

I get numbers like : 13809 13812 13812 13817




Aucun commentaire:

Enregistrer un commentaire