| Date Assigned: | Wed Oct-25 |
| Date Due: | Fri Oct-27 |
1. Write a truly working random(int,int) and randomD(int,int) -- done in class yesterday.
2. Calculate pi using Monte Carlo method and the random function from step 1.
Note that "cout" rounds, which is not at all good for this problem, so either figure out how to not make it do that (place the cursor of "cout" and hit F1 for help on "cout"), or just use "printf" instead (it still rounds, but after many more decimal places).3. Write a pseudorandom # generator using f(seed) = seed = ((abs(seed * BigNum1)) % BigNum2).
Make BigNum1 and BigNum2 relatively prime, and BigNum1 >> BigNum2. Also, you may want to set MY_MAX_RAND to BigNum2-1 (why?).4a. Verify the quality of your function in step 3.
How? First, redo step 2 using this function, and see if it computes pi as accurately or as quickly. Second, verify that the variance of the distribution is near 0. Third, compare the results of your function to the builtin rand() function. Fourth, for extra credit, think of more creative and more mathematically sound ways to prove randomness of a pseudorandom number generator.4b. Verify the quality of your tests in 4a.
How? By intentionally introducing some non-randomness into your random number generator and observing the5. Using Monte Carlo methods, determine how many people must be in a room in order for it to be probable that at least two share the same birthday.