anarres: (Default)
2010-04-04 06:13 pm
Entry tags:

Why randomness isn't really all that random

Sometimes, I do dorky things to amuse myself.

Suppose you generate 10 sets of 10 random numbers, either 0 or 1. In any given set you might get two or six or seven 1's, but it's a good bet that overall the average number of 1's per set will be about 5.

So I did this using Python (cheating a bit because I used pseudorandom numbers, but for something simple like this that should be fine). Here are my sets of numbers:

1: 0 1 0 1 0 1 0 1 1 0

2: 0 0 1 0 0 0 1 0 1 0

3: 0 1 0 0 1 0 1 0 0 1

4: 0 1 1 0 0 1 0 0 0 0

5: 1 1 0 1 1 0 0 1 1 1

6: 0 0 0 1 0 1 0 0 0 1

7: 1 1 0 1 1 0 1 1 0 0

8: 0 1 1 0 0 1 0 0 1 0

9: 1 0 0 0 0 0 0 0 0 0

10: 1 1 0 0 1 1 0 1 0 1

And here's a histogram of the results (made with the wonderful matplotlib plotting library):
(the axis labels don't show up so well: the horizontal axis is labelled "Number of 1's in a given set" and the vertical axis is labelled "Number of sets").




Read more... )