> > Is there a statistically better solution for generating random numbers than
> > Perl's built in rand() function? I noticed a couple modules on CSPAN, but
> > are they any better? I haven't done a true test of the spread
> regular rand()
> > gives, but it seems to me to give numbers closer to the top of the range
> > specified more often then numbers at the bottom of the range.
>
> http://random.org

That site said, "The true random numbers are generated using atmospheric noise
which for many purposes is better than the pseudo-random numbers typically
generated by computer programs."

You could access those numbers on their site with the LWP module.

I'm told that NASA sells random seeds, from cosmic rays or something.

You could make your own from atmospheric noise or the type of thing you see on
a TV screen not on a valid channel by using Perl control of a com port if, and
I don't know whether it can be done, if you can read an analog voltage on a com
port pin.  http://members.aol.com/Bbirthisel/alpha.html.

Ply a couple of rand() functions against each other and the distribution is
even:

#!perl

for (0..10) {
        $rand = rand();
        for (0..10) { push @rand, (rand() * $rand); }
}
for (@rand) { s#.*(\d\d)\d\d#$1#; }
for (sort @rand) { print "$_\n"; }

00
00
00
01
01
02
03
04
05
06
06
07
07
12
13
13
13
14
15
16
17
18
18
18
19
19
20
22
23
24
24
25
25
25
25
28
29
29
30
30
31
31
32
32
35
35
35
35
36
37
38
38
38
38
39
39
42
44
46
46
47
51
52
54
55
58
58
58
59
59
59
61
61
62
62
62
62
64
64
67
68
69
70
72
72
78
79
79
79
80
83
84
84
86
86
86
86
87
87
88
88
89
89
91
91
92
92
92
93
93
93
93
94
95
96
96
96
97
97
99
99

Will graph out to a quite linear line if you try it with increase to 0..100.

Another approach, take one of the digits from the result of the first rand()
and let it indicate which one of 10 formulas you think up will be applied in
each instance.

But then again, on my system Frank's script changed to 0..32000 creates results
that look plainly straight-line and evenly-distributed on a graph.

/g





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to