
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Random Number Functions in Python
Random numbers are used for games, simulations, testing, security, and privacy applications. Python includes following functions that are commonly used.
Sr.No | Function & Description |
---|---|
1 | choice(seq) A random item from a list, tuple, or string. |
2 | randrange ([start,] stop [,step]) A randomly selected element from range(start, stop, step) |
3 | random() A random float r, such that 0 is less than or equal to r and r is less than 1 |
4 | seed([x]) Sets the integer starting value used in generating random numbers. Call this function before calling any other random module function. Returns None. |
5 | shuffle(lst) Randomizes the items of a list in place. Returns None. |
6 | uniform(x, y) A random float r, such that x is less than or equal to r and r is less than y |
- Related Articles
- Generating random number list in Python
- How to pick a random number not in a list in Python?
- Random number generation in C++
- Random number generator in Java
- Random numbers in Python
- Mathematical Functions in Python - Special Functions and Constants
- Decimal Functions in Python
- Statistical Functions in Python
- Mathematical Functions in Python?
- Partial Functions in Python?
- Time Functions in Python?
- Operator Functions in Python
- Log functions in Python
- Iterator Functions in Python
- Trigonometric Functions in Python

Advertisements