lundi 29 janvier 2018

python random.getstate() and random.setstate()

Learning the module random here, in the very beginning there are book-keeping functions, I understand that to set a specific seed is to make sure obtaining same random number.

but, what about the getstate() and setsate()? link In the documentation, it has no introduction for what this state means, and if I don't know what it means, how could I set it right?

random.getstate()

Return an object capturing the current internal state of the generator. This object can be passed to setstate() to restore the state.

random.setstate(state)

state should have been obtained from a previous call to getstate(), and setstate() restores the internal state of the generator to what it was at the time getstate() was called.

Thanks,




Aucun commentaire:

Enregistrer un commentaire