What Is the Probability that Probability Is Correct? Can a Computer Generate Random Numbers Accurately?

CSEF · 2006 Mathematics & Software

Overview

Objectives/Goals My first objective was to see whether a computer using Java#s Math.random method can generate numbers as evenly as in real life events and as predicted by theoretical probability. My second objective was to see how sample size affects the distribution of random numbers. Methods/Materials I wrote two Java programs which used Math.random to generate random numbers that simulated real world events, flipping a coin and rolling a die. First, I simulated flipping a coin 1000 times and rolling a die 3600 times. I then flipped a coin and rolled a die the same number of times. I did two additional tests for my second objective. I flipped a coin ten times and rolled a die 36 times and modified the Java program to simulate a coin being flipped 10 and 100,000 times and a die being rolled 36 and 360,000 times. Lastly, I graphed and compared the data to reach my conclusions. Results The random number generator produced values whose percentages where closer to the expected theoretical percentage then when I physically rolled a die or flipped a coin. Also, in both the real life and computer randomness test, the larger sample sizes created values closer to the expected percentage. Conclusions/Discussion My conclusion is that the Math.random method can produce random numbers as accurately distributed as real life events. They are not true random numbers though since the random numbers produced are dependent on the seed value used to start the random number generator. I also concluded that when using both Math.random and real life randomness, the larger the sample size, the closer to the expected percentage the results will be.

Summary statement

My project was about determining if computers can generate random numbers as well as real world events and how sample size affects the number distribution.

Help received

Dad helped write Java programs.

Competition history

  • CSEF 2006 Mathematics & Software · Entry J1220

Resources

Related projects

Closest projects by meaning, across every fair and year in the corpus.

Browse more like this

Source: California Science & Engineering Fair public projects

Save projects to your library

Sign in with Google to keep track of projects you find interesting, organized into folders. An account also raises your daily allowance for “Has this been done?”, and lets you create a key for the MCP server with a much higher limit than anonymous use. Browsing stays public.

Continue with Google