random is a built-in function that generates random numbers
import module:
Then you can call the functions under the random module. Use dir(random) to view the functions under the random module. The results are as follows:
The most commonly used functions are as follows:
random.randint
The meaning of the statement is to generate a random number (integer int type) from 1 to 10 (including 1 and 10). (The parameter is an integer, not a floating-point number, otherwise an error will be reported)
random.random
random.uniform
which is
random.choice
random.randrange
random.sample
This module is very 666, and also supports triangular, beta distribution, exponential distribution, gamma distribution, Gaussian distribution and other very professional random algorithms.
random.shuffle
Using this method will result in None, because random.shuffle() is used to shuffle the list elements and has no return value, so you cannot use print(random.shuffle(a)) to output the shuffle
the sequence after