When the need to use random import random module is intended for use in the editor
random.randint: randomly generating a random integer
result = random.randint (1,999999) # random integer print (result) Results: 692,541
random.sample: randomly select several elements, returns a list, can pass strings, lists, a set of dictionaries can not pass
= {1,2,3,4,5} A Print (random.sample (A, 2)) # several randomly, returns a list, the first parameter is passed, the second is randomly several values results: [5, 2]
random.shuffle: reshuffle, there will be no return value
= A [1,2,3,4,5,6] random.shuffle (A) # shuffling print (a) Results: [4, 5, 2, 1, 6, 3]
random.choice: a randomly selected value
= A [1,2,3,4,5,6] RES = The random.choice (L) Print (RES) Results: 4
random.uniform: randomly selected within a range from decimal
random.uniform = RES (1,999999) Print (RES) Results: 964,756.283097852