Generating Random Numbers
CSEF · 2008 Mathematics & Software
Overview
Objectives/Goals This project tested three random number generators (functions in Excel, C++, and Java) and evaluated the results using chi-square values from each experiment to determine which program was most likely to generate unbiased random numbers. My hypothesis was that C++ was most likely to generate unbiased random numbers because this language is used to construct many computer programs and games which require a random number generator. Methods/Materials Random number functions in Microsoft Excel 2002, C++ (Borland C++), and Java (Microsoft J# 2005 express edition) were tested. Random numbers generated by each program were converted to integers between 0 and 9. When converting the random numbers to integer values care was taken to round the generated values in an equivalent manner to prevent bias. Each program was used to generate sets of 10, 100, 1,000, and 10,000 random numbers. The sets of random numbers (10, 100, 1,000, and 10,000) were generated five times with each program. Results For each experiment the measured frequencies were compared with the expected frequencies (10% of the total integers generated in each experiment). Chi-square tests were used to evaluate if each program was likely to be generating independent and unbiased random numbers. From the chi-square test results calculated for each experiment it was found that each program tested was likely to be generating unbiased random numbers. Conclusions/Discussion From the chi-square test results calculated for each experiment it was found that each program tested was likely to be generating unbiased random numbers. For larger sample sizes (1,000 and 10,000 random numbers) it was found that Excel was the most likely to generate unbiased random numbers.
Summary statement
This project tested three random number generators (functions in Excel, C++, and Java) and evaluated the results using chi-square tests to determine which program was most likely to generate unbiased random numbers.
Help received
Father showed how to use a chi-square distribution table out of a math handbook
Competition history
- CSEF 2008
Resources
Related projects
CSEF · 2013
The Randomness of Humans and Computers
CSEF · 2006
What Is the Probability that Probability Is Correct? Can a Computer Generate Random Numbers Accurately?
CSEF · 2007
Pseudo-Random Numbers
CSEF · 2009
Efficient True Random Number Generation
CSEF · 2007
A Pseudorandom Number Generator Based on a Suggestion by John von Neumann
CSEF · 2004
Free Choice vs. Random Numbers
ISEF · 2014
Comparison of Common Linear Pseudorandom Number Generators
CSEF · 2002
Can People Choose Truly Random Numbers?
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects