As the primary requirement, correctly implementing and controlling random number generation is vital for a range of scientific analyses and simulations across astronomy and planetary science. Beyond advice on how to set the seed, there is little guidance in the literature for how best to handle pseudo-random number generation in the current era of open-source astronomical software development. We present our methodology for implementing a pseudo-random number generation in astronomy simulations and software and share the short lines of python code that create the generator. Without sacrificing randomization at run time, our strategy ensures reproducibility on a per function/module basis for unit testing and for run time debugging where there may be multiple functions requiring lists of randomly generated values that occur before a specific function is executed.
Read full abstract