vendredi 17 juin 2016

How can I find out what the seed was when creating a Random object?

when you create a .net Random object with no parameter, you get, as the docs put it:

Initializes a new instance of the Random class, using a time-dependent default seed value.

On the other side, you can specify the seed.

System.Random rand1 = new System.Random();
System.Random rand2 = new System.Random(222);

For rand2 the seed is known. How can I find out the seed of rand1 in order to obtain the same result at a different point in time?




Aucun commentaire:

Enregistrer un commentaire