One very useful ability of a computer is the creating of random numbers. To be clear these are only pseudorandom numbers. That is they not random at all, but completely determined by the algorithm and a user supplied seed. However, they behave like random numbers and can be used as if they were randomly generated. The package random will generate random numbers as will the subpackage numpy.random. The main difference is if you need arrays of random numbers it is better to use numpy. Some examples:
import random
random.seed(12345) #create a seed
i=random.randint(0,10) #get random int between 0 and 10
f=random.random() # random float between 0 and < 1.0
f2=random.uniform(2,3) # random float between 2 and 3
l=random.choice(sequence) # choose a random value from a sequence
g=radnom.gauss(0.0,1.0) # choose from normal dist. mean=0,std=1
import numpy as np
rng = np.random.default_rng(seed=42) #initialize generator with seed
i=rng.integers(low=0,high=10,size=5) #5 ints between 0 and 10
x=rng.random(size=50). #50 uniform between 0 and 1
g=rng.normal(loc=0.0,scale=1.0,size=5) #5 from normal mean=0,std=1
Note many common distributions are also available; lognormal, beta, gamma, exponential, etc.