This module can be used when imported at the top of a Python file:
random variable can then be used for executing the module’s built-in methods, like the
.random() method below:
- Returns a random item chosen from an iterable argument, such as a list or a dictionary.
- Returns a random integer that exists between two values.
- Returns a pseudo-random floating-point number between 0 and 1.
- Selects a random number from a defined range of int values.
- Returns a list of items randomly selected from a given population.
- Initializes a pseudo-random number generator with a seeded value and sets the first number.
- Takes a list and randomly re-orders the items.
- Returns a pseudo-random floating-point number between two given numbers.
Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.