Re: RNG Test: Code to generate Diehard file in Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Fri, 18 Feb 2000 02:16:41 -0500, Brian Broker <bkb at CNW.COM> wrote:

>On Fri, 18 Feb 2000 01:05:01 -0500, Everett Williams wrote:
>
>>numbers generated by rand(#FFFF) and they looked completely random
>>and 32 bit. They also tested to be fairly decently random in the Diehard
>>test. Go figure. Mr. Craig, why is this so? It is obvious that something is
>>going on here that doesn't quite meet the eye.
>
>There's really nothing 'going on' here. If you look again at your program,
>you will see that you are writing out 20 16-bit 'random' numbers per line,
>which is equivalent to 10 32-bit numbers per line (which is the format that
>the data conversion program wanted).  Also note that rand(x1) returns an
>integer from 1 to x1 (so you can't get a result of #0000).  Of course it
>will all _look_ random to the eye.  After all, if rand() could return zero,
>then your chance of getting one with rand(#FFFF) would be 1 in 65535.  This
>is also the reason the numbers look good to DieHard (much better than shift-
>left-two of a 30-bit rand).
>
>-- Brian

Right again. Somehow, I was looking at each rand as producing 4 bytes per
execution rather than 4 hex digits per execution. It does, but the printf was
pulling off the two significant bytes representing 4 hex digits per.  I adjusted
to fit to get the result that I wanted, but did not examine my assumption.

Thanks,

Everett L.(Rett) Williams
rett at gvtc.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu