Chapter Six

Generating Random Variables

6.1 Introduction/Purpose of the Chapter

In this chapter we talk about methods used for simulating random variables. In today's world where computers are part of any scientific activity, it is very important to know how to simulate a random experiment to find out what expectations one may have about the results of the phenomenon. Applying the Central Limit Theorem (Chapter 12) and simulation methods allows us to draw conclusions about the expectations even if the distributions involved are very complex. However, in order to apply simulation methods, we need to be capable of generating random variables with the needed distribution.

Throughout this chapter we assume as given a Uniform(0,1) random number generator. Any software is capable of producing such random numbers, and the typical name for a uniform random variable is RAND. For a more recent development and a very efficient way to generate exponential and normal random variables without going to uniform, we refer the reader to Rubin and Johnson (2006). The ziggurat method developed by Marsaglia and Tsang (2000) remains one of the most efficient ways to produce uniforms, and it is used in Matlab. The Mersene twister is another efficient way to create these random numbers (this is the default method in R). 179

6.2 Vignette/Historical Notes

Before modern computers, researchers requiring random numbers would either (a) generate them through rolling dice and shuffling cards or (b) use tables ...

Get Handbook of Probability now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.