What are the advantages of using pseudorandom numbers in Monte Carlo simulation instead of random numbers? What are other applications of pseudorandomness in astrophysics? Many thanks.
The primary advantage of pseudorandom numbers is speed (as Cristiano mentioned) and convenience: they're what are available in almost any software package or library, whereas true random number generators are not. As long as you use a pseudorandom number generator (PRNG) with good statistical qualities and are not worrying about true cryptographic randomness, this is perfectly acceptable.
In addition to Monte Carlo simulations, pseudorandom number are used for many different applications, including all sorts of physical simulations (cosmological, stellar evolution, planet formation, etc.), statistical analyses (bootstrap resampling), initial conditions for fits, updating parameters in genetic algorithms, sample selection, etc.
A personal example: I've worked on two different studies where we were making classifications of different aspects of galaxies, based on their individual isophote plots or radial surface-brightness profiles. Rather than worrying about the possibility of subtle biases based on possible knowledge of individual galaxies ("Oh, it's NGC 1097, I'd expect that galaxy to be..." or "Well, the list is alphabetically ordered, so the middle galaxies will have NGC prefixes, and those will mostly be really luminous galaxies, so..."), we set up a blind analysis system, where the galaxies were presented to us in a random order, without names (with the actual identifications automatically recorded where we couldn't see them until the whole thing was over). The randomness of the order was, of course, really pseudorandom order.
This is how things like Galaxy Zoo work, for example: the individual galaxies that citizen scientists classify are (pseudo)randomly selected. (And for one of the projects I mentioned above [Kruk et al. 2019], we set up the classification process using the "Zooniverse" framework that Galaxy Zoo developed).
A separate advantage is that if you save the number used as the seed for the pseudorandom number generator, you can use that to regenerate the exact set of pseudorandom numbers used in the analysis/simulation/whatever, which can be very useful for debugging purposes, and also for allowing others to replicate your results. (E.g., you run some kind of relatively short/simple simulation, and derive some results and figures from that. How can someone else trust that your results and figures accurately represent the simulation? Provide them with the code and the PRNG seed, and then can generate the same simulated/random-sampling results and check. Plus, they can vary the seed and make sure you didn't cheat -- or fool yourself -- by reporting atypical results. Here's a Github site for a recent paper of mine that includes both the code for a survey simulation and the seed number I used for the figure in the paper.)
What are the advantages of using pseudorandom numbers in Monte Carlo simulation instead of random numbers?
Where are you going to get those true random numbers? Even reading from
/dev/random has documented issues with not being truly random, and even worse, It. Is. Slow. (Or it would be slow if it was implemented as originally conceived. To make it faster, most implementations of
/dev/random deviate from the concept of blocking until it builds up sufficient entropy. Even then, it is still slow. It's just not all-caps SLOW.) Except for computers outfitted with specialized hardware devices designed to provide lots of entropy, you are not going to get true random numbers on a computer.
Suppose you are asked to build a Monte Carlo-based simulation of a galaxy for your masters degree thesis. (This is not PhD-level, at least not anymore.) You most likely will not get your thesis approved if you use
rand() as the basis for your randomness. Many implementations of
rand are worse than bad. On the other hand, you also most likely will not get your thesis approved if you use
/dev/random, or even a cryptographically-secure random number generator, as the basis for your randomness.
/dev/random, if properly implemented, is SLOW. A cryptographically-secure random number generator (which theoretically predictable) is merely slow. Your simulation needs something that is fast. Just as lousy (e.g.,
rand()) is not good enough, something that is slow also is not good enough. Physics-based Monter-Carlo simulations need something that is fast, and more importantly, that passes most if not all tests of "randomness".
On the third hand, despite being over 20 years old, no one will blink an eye if you use Mersenne Twister. Despite its age, and despite that better techniques that are equally fast (maybe even faster) have been developed since, MT remains more than good enough from the perspective of randomness tests. MT is the current state of the practice technique for generating reasonably good random numbers.
This isn't astrophysics, but suppose you are part of a team that develops a simulation of a lander that takes humans to the surface of the Moon. Suppose your simulation shows that 9900 out of a 10000 simulation runs has the vehicle landing successfully, but 100 crashed into the surface. There should only have been 27 or so crashes out of 10000 runs per NASA's three sigma rules. You had better investigate those hundred cases, and fix the underlying problems. Deterministic behavior is very, very helpful in this regard.
Getting back to astrophysics, deterministic behavior of a pseudo random number generator helps developers of astrophysics simulations find bugs in their software. Suppose all the bugs have been identified and fixed, and they still get some weird behavior in some cases. That weird behavior might well be real! Once again, deterministic behavior in a Monte Carlo simulation proves to a feature rather than a flaw. The weird emergent behavior in a few special cases suggested by the initial Monte Carlo simulation can become the subject of subsequent investigations.