mercredi 16 mars 2016

How can I get the seed from a Random already created

I have to be able to repeat an experiment made with my code, it makes a few random numbers and I need to get the initialization value of my new random() sentence. I have this sentence to make the random object I use

Dim r As Random = New Random()

As I have read it gets the initialization value from system datetime. If the experiment were successfull I'd needed to be able to repeat it. How could I get the initialization number to be able to do:

 Dim r As Random = New Random(OldInitializationValue)

I think I'll have to make a Initialization value myself each time I execute my app but If there were a method to save it I'd be glad to know it.

Thank you in advance for your answers.




Aucun commentaire:

Enregistrer un commentaire