|
||||||||
When I was working on my PhD thesis, I had to write a Monte Carlo simulation where I had to generate random numbers following a Maxwellian distribution and other distributions of the same kind. I looked for a fast way to do it and surprisingly, I found nothing! I found formulae for exponential and gaussian laws, but that was it! I still have a hard time believing that the algorithms I developed were unknown before, but to this day I haven't seen them anywhere. I saw people using a general algorithm (valid for any distribution, but much slower) to do it, confirming that the fast algorithm presented here are not widely known, although those distributions are very common in nuclear physics. I will present also the well-known algorithms for the exponential and gaussian laws, since they will help to understand the other cases. (These can be found in the Numerical Recipes). Table of contents1. Exponential2. Gaussian 3. Volume source evaporation 4. Maxwellian 5. Higher dimensions
| ||||||||