Random numbers, continued

Tutoring math, computer science might always be around the corner.  The tutor continues the discussion of random numbers, including a “live” example.

As I mentioned in my previous post, random numbers comprise a favourite topic among computer science people. At its core is the paradox of a random number being produced by a calculation device.

The definition of random, from the point of view of statistics, is that every possible value has an equal chance of being selected. For example: imagine you write each number from 1 through 100 on its own (equal-sized) slip of paper, put the slips all into a hat, then have someone reach in (without looking) and grab one of the slips of paper. We’d likely agree that’s a random selection. The person drawing the number, we believe, would be equally likely to pull out any of the slips of paper, hence any number between 1 and 100.

The experiment above is trustworthy because we can picture it and empathize with the person drawing the number. We know that, not looking at the hat while pulling the number from it, we ourselves would be hard-pressed to control the number drawn. When a computer produces a random number, however, we may not know how. The question inevitably arises, “Can we be certain the number is random?”

To offer some reassurance that the random numbers offered by computers are “random enough”, I’ve put a random number generator below for the skeptical reader to try. You can look at each number in its totality, or just follow certain digits – the fifth digit of each number produced, for instance. For random numbers between 1 and 100, you could follow the fifth and sixth digits, for another example.

This random number generator is powered by the Javascript built-in Math.random() function. Like many, it produces a number between 0 and 1. Users can customize the results, if desired, using other mathematical functions that multiply and round.

Your random number is  

I’ll be discussing Javascript and other aspects of tonight’s post in future ones:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply