mpacts.tools. random_seed

Utility module to handle the ‘seeds’ for pseudo-random-number generators used by mpacts and its surrounding (e.g. numpy)

In order to be able to use this module import it like this:

import mpacts.tools.random_seed
#or assign it to a shorter name
import mpacts.tools.random_seed as ran
mpacts.tools.random_seed.get_random_seed()

Gets the random seed set by this tool; only call this _after_ set_random_seed()!

mpacts.tools.random_seed.produce_random_seed()
mpacts.tools.random_seed.set_mpacts_random_seed(seed=1039597720)

Sets the given random seed, or by default a ‘true’ random number provided by the os as the seed of MPacts rng configuration seed. Update the global seed as well.

mpacts.tools.random_seed.set_numpy_random_seed(seed=1039597721)

Sets the given random seed, or by default a global seed incremented by one as the seed of numpy.random. It does not update the global seed.

mpacts.tools.random_seed.set_python_random_seed(seed=1039597722)

Sets the given random seed, or by default a global seed increased by two as the seed of std.random. It does not update the global seed.

mpacts.tools.random_seed.set_random_seed(seed=1039597720)

Sets the given random seed, or by default a ‘true’ random number provided by the os as the global seed of std.random, numpy.random, and the MPacts rng configuration. The ‘random’ seed is the MPacts-seed+2 and ‘np.random’ is MPacts-seed+1.