comp.lang.c
[Top] [All Lists]

Re: what this program do

Subject: Re: what this program do
From: "Dik T. Winter"
Date: Thu, 27 Mar 2008 14:05:33 GMT
Newsgroups: comp.lang.c

In article <47EBA03D.9427DF0A@xxxxxxxx> Morris Dovey <mrdovey@xxxxxxxx> writes:
...
 > I got to thinking about how one might go about using the pi and e
 > digit strings to build a random number generator. Seemed like a
 > good idea at the time. :-)
 > 
 > Then I wrote a tiny program to give me the digit frequencies and
 > decided that the idea might not be as good as I'd thought it
 > might be. With a initialized to 10000 and the printf() format
 > changed to "%.3ld" to produce the digits, I ran my little counter
 > program to get:
...
 > Which surprised me because I'd expected a much more even
 > distribution.

You would have gotten that with the format string "%.4d".  On the other
hand, using pi and e for random digits only works when they are normal
to base 10 (and there must be some additional randomness in the digits).
It is unknown whether they are.
-- 
dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn  amsterdam, nederland; http://www.cwi.nl/~dik/

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy