jeudi 26 janvier 2017

How to generate random numbers in C++ without using time as a seed

My program is supposed to generate random number with a fixed max of 9999. These numbers are used to create objects. Now the problem is when using time, if I create two objects one after the other both will be created with the same number (as time hasn't changed in the process). My question is hw can I do that more efficiently so I can generate a distinct random number everytime I run the program?

Thanks in advance !




Aucun commentaire:

Enregistrer un commentaire