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

Image

10. The Umbrella Quandary

The code umbrella.m performs 10,000 simulations of the man’s walks for each of the ninety nine values of rain probability, from 0.01 to 0.99, in steps of 0.01. That is, it performs a total of 990,000 simulated walks. We don’t have to simulate for p = 0 (it never rains) because, obviously, in that case the man never gets wet; i.e., the answer for p = 0 is that he’ll walk an infinite number of times before his first soaking. That’s the answer for p = 1, too (it always rains), but for a far different reason. For p = 1 the ...

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