vendredi 7 avril 2017

internal state of python random module

import random
random.seed(234)
state = random.getstate()

The result state is a tuple:

(3, (.... many long integers...),  None)

What does this exactly mean? I know I can save the state and use random.setstate(state) to recover the internal state for any random number generator used in this module. But I dont know what are these values in the state mean. The official document doesn't say any detail about it. I guess it might mean the parameters for determine a random state.




Aucun commentaire:

Enregistrer un commentaire