11 Dec 2018: Pseudo-random Number Generation

  • Please fork the following repl.it:

  • Uncomment Block A and run.

    • What is the cycle length of bad_rng?

    • Write a for() loop that draws numbers from bad_rng and prints output when the draw equals seed

    • Alter bad_rng by varying the first 2 arguments, i.e., eperiment with different values of mult and increment. What cycle lengths do you observe?

  • Uncomment Block B and run. What’s happening?

  • Uncomment Block C and run. What’s happening?

  • Uncomment Block D and run. What’s happening?

    • What happens as you increase ndraw?