Python Random Module
Random number generation — random, randint, choice, shuffle, sample. This category documents 10 Python random module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: random.random(), random.randint(), random.choice(), random.choices(), random.sample(), random.shuffle(), random.uniform(), random.gauss(), random.seed(), random.getrandbits(). random.random() returns a random float in the range [0.0, 1.0). random.randint() returns a random integer N such that a <= N <= b. random.choice() returns a random element from a non-empty sequence. random.choices() returns a list of k random elements with optional weights (allows duplicates). random.sample() returns a list of k unique elements chosen without replacement. Random Module belongs to the Math & Stats group alongside Math Module, Statistics Module, Decimal Module, Fractions Module. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground.