initRandom
- pyagrum.initRandom(seed=0)
Initialize random generator seed. If
seed=0, the generator is initialized from the current time in ms.seed!=0allows to fix the generator in a certain stage and then allows to repeat the same pseudo-random numbers sequence.This is the way to act directly on the generator at any time. At start, pyAgrum uses the key
core.randomSeedof the configuration (0, the current time, by default): changing this key later has no effect on the generator.A given seed gives the same draws on every platform.
- Parameters:
seed (
int) – the seed used to initialize the random generator (0 if using time)- Return type:
None
Example
import pyagrum as gum
gum.initRandom(42)
x = gum.randomProba()
gum.initRandom(42) # the same seed gives the same sequence
x == gum.randomProba()
# True