jeudi 29 juin 2017

How to properly seed a 64 bit random generator with time

I would like to generate 64 bit integers using the standard c++ std::mt19937_64 without manually seeding it. When defining the seed though, this question occurred to me: is there a proper way of seeding such a random generator using the current time (eg. producing a number based on the current time point, that is at least as big as a 64 bit int)? Something like counting milliseconds from the Unix epoch? Is there an easy way to achieve this?




Aucun commentaire:

Enregistrer un commentaire