Reproducible results
Not met yet
A result is reproducible when someone else can run it again and get the same numbers. Give every random draw a seed: np.random.default_rng(7) starts the same sequence every time it is made, though each call on it carries on to the next numbers. random.seed doesn't touch NumPy's generators. One seed is still one sample, so run several, report the median and the spread rather than the best, and write down the settings and versions you used.
Try it
main.pyOutput
Press Run and what your program prints shows up here.
Easy to get wrong
- Thinks a seeded random generator gives the same numbers on every call. The seed fixes the sequence; each call takes the next numbers in it.
- Thinks random.seed also fixes NumPy's generators. NumPy's default_rng needs a seed of its own.
- Thinks one run with a fixed seed shows a result holds. A fixed seed makes one sample repeatable; it doesn't make it typical.