Learn about how random numbers are generated on a computer.
Write a pseudo-random number generator.
In the previous modules, you have been working closely with functions that produce random numbers and results, but were those numbers truly random? Take a moment to think about what it means for something to be random. Note your thoughts down on your webpage.
Now consider the following:
This is called pseudo-random number generation. It uses a mathematical formula to produce numbers that appear to be random. If you provide the same input, you will get the same sequence of numbers every time. In order to produce truly random numbers, computers need an additional source of randomness. This is usually gathered from the environment around them.
Creating a pseudo-random number generator that produces numbers with equal probability and that cannot be predicted is a difficult task. You will be competing against your peers to produce the best pseudo-random number generator with these two properties. Open randomNumbers.py in gedit to set started. Keep trying to improve the formula.
Tip: When you find a good formula, leave it in the code by commenting it out with # instead of deleting it.
Take a screenshot of your code and answer these questions on your webpage!