Chapter 2 Exercises
The "how many" trick

1. Imagine simulating a series of random numbers from a uniform distribution on the interval (0,1) and adding them up. Adapt the code in Example 2.5.1 to calculate the expected number of terms required to make the sum exceed one. [Hint: this will be one more than the largest number for which the sum < 1.] Does the resulting expected value look familiar? 2. Add one line to your code to allow calculation of the probability that n terms will sum to less than one. What is the probability for n=5?