O'Reilly logo

Digital Dice by Paul J. Nahin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

image

APPENDIX 8

How to Simulate an Exponential Random Variable

In Problem 15 (How Long Is the Wait to Get the Potato Salad?) it is necessary to generate random numbers that are not uniformly distributed from zero to one (which MATLAB’s rand does for us) but rather are exponentially distributed from zero to infinity. That is, we need to simulate a random variable T whose values are described by the probability density function

 

images

where λ is an arbitrary positive constant. (In Problem 15, λ has an important physical interpretation.) MATLAB has no built-in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required