RNG Test: Code to generate Diehard file in Euphoria

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

--=====================_21804193==_.ALT


The following code generates a 15MB file of random numbers. Output is in hex.

--randout.txt
--creates a file for use with the Diehard Tests
--(c)1999 Joel Hunter Crook
--free for non-commercial use

atom file_number, output1, output2 -- ,final
sequence file_name , final
file_name="rndout.txt"
file_number=open(file_name,"w")

for i=1 to 4000000 do
        final={}
        for j= 1 to 10 do

                output1=rand(#FFFF) -- 4 bytes
                output2=rand(#FFFF) -- 4 bytes
                final&=output1&output2

        end for -- j
-- final now equals 80 bytes or 640 bits
        printf(file_number,"%x",final)
end for -- i




At 03:15 PM 02/14/2000 -0500, you wrote:
>I believe that one of the standard tests for randomness is to treat the input
>file as a bit stream and measure the distance between ones and then throw
>that into various statistical distributions. The unshifted, unfilled version
of
>the numbers is likely to produce a major peak in this set of calculations, but
>it still might be instructive to see just what it does generate.
>
>Everett L.(Rett) Williams
>rett at gvtc.com

Joel H. Crook

Manager, Information Services
Certified Novell Administrator
Microsoft Certified Professional, OS Specialist

Kellogg & Andelson Accountancy Corp.
14724 Ventura Blvd. 2nd Floor
Sherman Oaks, CA 91403
(818) 971-5100

--=====================_21804193==_.ALT

<html><div>The following code generates a 15MB file of random numbers.
Output is in hex.</div>
<br>
<div>--randout.txt</div>
<div>--creates a file for use with the Diehard Tests</div>
<div>--(c)1999 Joel Hunter Crook</div>
<div>--free for non-commercial use</div>
<div>&nbsp;</div>
<div>atom file_number, output1, output2 -- ,final</div>
<div>sequence file_name , final</div>
<div>file_name=&quot;rndout.txt&quot;</div>
<br>
<div>for i=1 to 4000000 do</div>
j= 1 to 10 do</div>
<br>
-- 4 bytes</div>
-- 4 bytes</div>
<br>
for -- j</div>
<div>-- final now equals 80 bytes or 640 bits</div>
<div>end for -- i</div>
<br>
<br>
<br>
<br>
<div>At 03:15 PM 02/14/2000 -0500, you wrote:</div>
<div>&gt;I believe that one of the standard tests for randomness is to
treat the input</div>
<div>&gt;file as a bit stream and measure the distance between ones and
then throw</div>
<div>&gt;that into various statistical distributions. The unshifted,
unfilled version of</div>
<div>&gt;the numbers is likely to produce a major peak in this set of
calculations, but</div>
<div>&gt;it still might be instructive to see just what it does
generate.</div>
<div>&gt;</div>
<div>&gt;Everett L.(Rett) Williams</div>
<div>&gt;rett at gvtc.com</div>
<br>

Joel H. Crook<br>
<br>
Manager, Information Services<br>
<font size=1>Certified Novell Administrator<br>
Microsoft Certified Professional, OS Specialist<br>
<br>
</font><b>Kellogg &amp; Andelson Accountancy Corp.<br>
</b><font size=1>14724 Ventura Blvd. 2nd Floor<br>
Sherman Oaks, CA 91403<br>
(818) 971-5100<br>
</font></html>

--=====================_21804193==_.ALT--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu