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 frombad_rng
and prints output when the draw equalsseed
-
Alter
bad_rng
by varying the first 2 arguments, i.e., eperiment with different values ofmult
andincrement
. 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
?
-
-
Please view the following repl.it: