randomGeneratorSeed

pyagrum.randomGeneratorSeed()

Give the seed of the pseudo-random generator, to replay a sequence of draws.

Returns:

the seed of the generator: the value given to the last call to pyagrum.initRandom or, if it was 0, the value taken from the current time. Given to pyagrum.initRandom, or used as core.randomSeed in a file pyagrum.ini, it repeats the same sequence of pseudo-random numbers.

Return type:

int

Example

import pyagrum as gum

gum.initRandom(0)  # a seed taken from the current time
seed = gum.randomGeneratorSeed()
x = gum.randomProba()
gum.initRandom(seed)  # replays the same sequence
x == gum.randomProba()
# True