TST: Do not use random seed in doctest
See original GitHub issueSee https://github.com/astropy/astropy/pull/10644#pullrequestreview-634247783 from @tupui
We did this (#10644) in SciPy and the only difference is that we removed all seeding from examples. This is to enforce best practices. Using small seeds is bad for the entropy of the generator and also common values like 0, 42, 12345 end up in every code which leads to bias in results. Seeing should only be used for testing.
Here I am proposing to remove the seed and just allow variation in the results to pass the doctests (in SciPy I can add # random
or # may vary
, I am not sure if this is standard or not. Maybe this is your # doctest: +FLOAT_CMP
?).
I can do a PR on this branch if you want some help. Also, I would suggest to add somewhere in the doc a paragraph about seeding. See what we did for example https://scipy.github.io/devdocs/tutorial/stats.html#random-number-generation.
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (7 by maintainers)
Top GitHub Comments
Ok thanks for the update! No problem, just let me know 😉
FYI, for another reference, I did this for scikit-image here https://github.com/scikit-image/scikit-image/pull/5357