2.1. Random About

2.1.1. random

Table 2.1. random

Function

Description

random.random()

Random float: 0.0 <= x < 1.0

random.randint(min, max)

Return a random integer N such that min <= N <= max. Max is included

random.gauss(mu, sigma)

Gaussian distribution. mu is the mean, and sigma is the standard deviation

random.shuffle(list)

Randomize order of list (in place)

random.choice(list)

Single random element from a sequence

random.sample(list, k)

k random elements from list without replacement

random.seed(a=None, version=2)

Initialize the random number generator. If a is omitted or None, the current system time is used

2.1.2. Pseudo and Pure random numbers

  • What are pseudorandom numbers?

  • Why it is not possible to generate a pure random number?

  • What is random.seed(0)?