Study
NumPy · Random numbers
The Generator API (default_rng), seeding for reproducibility, distributions, shuffling, and sampling without replacement.
- Use rng = np.random.default_rng(seed); the old np.random.seed global state is legacy.
- The same seed gives the same sequence, which makes experiments reproducible.