Skip to main content

Random Module

import random
print("Random Int")print(random.randint(1, 10)) # random int between 1 and 10
print("Random Decimal")print(random.random()) # random decimal number between 0 and 1print(random.random(-5, 5)) # random decimal number between -5 and 5
print("Random Normal Distribution Decimal")print(random.randGauss()) # random decimal number from a normal distribution with mean 0 and standard deviation 1print(random.randGauss(12.5)) # random decimal number from a normal distribution with mean 12.5 and standard deviation 1print(random.randGauss(-20, 9)) # random decimal number from a normal distribution with mean -20 and standard deviation 9

A list of all the methods that the random module has, and how to use it.