lundi 27 mars 2017

Optimal constant seed for Mersenne Twister in C++ 11

My use case is: I need random numbers, but just for graphics (not for cryptography). I need to be able to get the same image (result) for 2 renderings/runs. For example, using time() as seed would not create the same result for the next run. So I need a constant seed.

The documentation for the Mersenne Twister says that it does not like 0 as seed, it also dislikes certain bit combinations. For such cases it is said to take up to 800000 calls until it delivers good random numbers again. For speed reasons I don't want to spend the overhead of 800000 calls. Ideally I would need some nice and trusted value(s) that I can use as seed directly.

Aucun commentaire:

Enregistrer un commentaire