Random Numbers and Seeds
Reproducible synthetic data with NumPy.
Why Generate Random Data
Real datasets are not always handy. Random numbers let you build test data, simulate scenarios, and shuffle samples on demand.
The Modern Generator
Start by creating a generator with default_rng. This is the current, recommended way to make random numbers in NumPy.
rng = np.random.default_rng()All lessons in this course
- Reshape and Flatten Arrays
- Sum, Mean, and the Axis Trick
- Boolean Masks for Selection
- Random Numbers and Seeds