[Wellington-pm] Select at random from a list

Philip Plane philip at xinqu.net
Wed Jul 19 19:24:43 PDT 2006


Hi All,

We haven't flogged my simple script to death yet. One more data point.

On Sat, 15 Jul 2006, Jacinta Richardson wrote:

> When you say it doesn't seem to be as random as you hoped, what are you
> using as your measurement for randomness?

I did a little test to see if random() produced significantly different
results being run once per invocation as opposed to in a loop. This took a
while because the loop was pretty fast compared to starting perl up
750,000 times :)

Here's the output from the loop:

Values 1228
Samples 740845
Average 603
Maximum 686
Minimum 524
Mean 603.293974 Variance 608.550021     Standard Dev: 24.668807

Here's the output from running the script 740,846 times.

Values 1228
Samples 740846
Average 603
Maximum 687
Minimum 524
Mean 603.294788 Variance 636.770405     Standard Dev: 25.234310

So they're both pretty random, certainly random enough to select MP3s for
me.

-- 
Philip Plane    _____   philip at xinqu.net
                  |
  ---------------( )---------------
Glider pilots have no visible means of support


More information about the Wellington-pm mailing list