anarres: (Default)
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... )

Profile

anarres: (Default)
anarres

July 2012

S M T W T F S
1234567
891011121314
151617 18192021
222324 25262728
293031    

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 5th, 2025 08:44 am
Powered by Dreamwidth Studios