skrf.mathFunctions.set_rand_rng

skrf.mathFunctions.set_rand_rng(rng)[source]

Set the global numpy random number generator instance for generating random numbers in scikit-rf. This is useful for fixing a random seed for reproducible Monte Carlo analysis.

This function is expected to be called before using any scikit-rf features, since it’s a global variable and thread-unsafe. To temporarily change the random number generator of a particular method (e.g. skrf.media.Media.random()), use the rng argument instead.

Parameters:

rng (numpy.random.Generator) – Any random number generator accepted by numpy.

Return type:

None

Examples

>>> set_rand_rng(np.random.default_rng(seed=42))