Home >>Python Random Module >Python Random setstate() Method
Python Random setstate() Method in python is used to restore the state to the specified state of the random number generator.
Syntax:random.setstate(state)
Parameter | Description |
---|---|
state | It is Required to restore the state of the random number generator. |
import random
print(random.random())
state = random.getstate()
print(random.random())
random.setstate(state)
print(random.random())
import random
print(random.random())