Standard library
random
Native pseudo-random helpers backed by the runtime generator.
Functions
random() returns a floating-point value from 0 through 1. randint(a, b) includes both integer bounds. randrange accepts one to three integer arguments. uniform(a, b) returns a floating-point value in the requested interval. choice(list) selects an item. seed(value) resets the generator.
random.tk
use random
random.seed(42)
print(random.random())
print(random.randint(1, 6))
print(random.randrange(0, 10, 2))
print(random.uniform(1, 2))
print(random.choice(["a", "b", "c"]))