experimental.random_extras
Additional random functions that are part of standard Python3’s random module but are omitted from MicroPython’s implementation
Specifically _not_ called “random.py” to prevent clobbering the standard random import in other experimental libraries
- experimental.random_extras.normal(mean=0.0, stdev=1.0)
Generate a random number with a normal distribution
Uses the Marsaglia-Tsang algorithm, which isn’t a perfectly normal distribution, but is likely close enough for EuroPi applications
- Parameters
mean – The desired mean for the distribution
stdev – The standard deviation of the distribution
- Returns
A floating-point number chosen from a normal distribution with the given mean and standard deviation
- experimental.random_extras.shuffle(l)
Re-order the elements of a list in-situ
- Parameters
l – The list to shuffle