Random number generation
Assignment
The purpose of this programming assignment is for you to get a hands-on experience with elementary statistics.
Program the following experiment in a programming language of your choice.
- Generate 10,000 random numbers distributed uniformly in 0..1, and plot them in 100
equally space intervals: [0..0,01[, [0,01..0,02[, ..., [0,99..1,00])
-
How many numbers do you expect to fall in each interval?
Do you actually get exactly that number? Why?
Do your results make sense according to statistical theory? Why or why not?
Repeat the experiment and ask yourself the same questions for the following cases,
- Generate 100,000 random numbers distributed uniformly in 0..1, and plot them in
100 equal space intervals.
-
Generate 100,000 random numbers distributed uniformly in 0..1, and plot them in
1000 equally space intervals.
-
Generate 1,000,000 random numbers distributed uniformly in 0..1, and plot them in
100 equally space intervals.
-
Generate 1,000,000 random numbers distributed uniformly in 0..1, and plot them in
10000 equally space intervals.