Random numbers with a Generator
What it is
rng = np.random.default_rng(seed) creates a generator; rng.standard_normal, rng.integers, rng.permutation, rng.choice draw from it. The legacy np.random.seed / np.random.rand interface uses one hidden global state.
Why it matters
A generator you pass around makes a result reproducible and a test deterministic without any function secretly depending on global state that some import may already have advanced.
In the real world: Simulating thousands of possible demand scenarios to decide how much stock a warehouse should hold.
rng = np.random.default_rng(0)
X = rng.standard_normal((1000, 8))
idx = rng.permutation(len(X))[:100] # a random subsample, reproducibly
rng.integers(0, 10, size=5) # high is exclusive, unlike randintSeeding globally with np.random.seed(0) and believing the run is reproducible. Anything else in the process that draws from the global generator changes your numbers, and library code does draw from it.