Re: More on Random Number Generators in Euphoria
- Posted by Joel Crook <joel at MAIL.K-A.COM> Feb 14, 2000
- 609 views
--=====================_14631672==_.ALT from the DIEHARD Manual: "Write a main program that sends the (hex) output of your random number procedure to an ordinary ascii file. Then invoke the file on this disk, ASC2BIN.EXE that will prompt for the names of your input and output files and do the conversion. Your random number generator should produce 32-bit integers. (If 31 bits, left justify by shift-left-one, as some of the tests in DIEHARD favor leading bits.) You should send them to your ascii file in hex form, 8 hex 'digits' per integer, 10 integers per line, no intervening spaces. The ascii file will be twice as big as the binary file it is reduced to. You can see that DIEHARD requires large test files. But they need only be created one at a time, then deleted." The program analyses the "goodness" (randomness) of the *bits* so a 0x3FFFFFF limit is not relevant. Think of it as an 80,000,000 iteration cointoss. At 04:34 PM 02/14/2000 -0400, you wrote: >On Mon, 14 Feb 2000, Brian Broker wrote: > >> On Mon, 14 Feb 2000 13:22:01 -0500, Everett Williams wrote: >> >> >Has anybody run the Euphoria RNG through the Diehard test? >> >> I decided to go ahead and look into this. The Diehard test is looking for >> 32-bit random numbers... The problem with Euphoria's 'rand' function is >> that it will only produce random numbers up to 0x3FFFFFF (instead of >> 0xFFFFFFFF). What would be an acceptable method to obtain the required >> range? Is it acceptable to generate two 16-bit random numbers and >> concatenate them? Does anybody have any other valid suggestions? I could >> try all suggested methods and see what works best... >> >> -- Brian >> > > It would be acceptable to concatenate two 16 bit integers provided >you apply the results of the test only to 'the concatenation of two 16 bit >integers as generated by rand()'. =) 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 --=====================_14631672==_.ALT <html><div>from the DIEHARD Manual:</div> <br> <div> "Write a main program that sends the (hex) output of your random</div> <div> number procedure to an ordinary ascii file. Then invoke the</div> <div> file on this disk, ASC2BIN.EXE that will prompt for the names</div> <div> of your input and output files and do the conversion.</div> <br> <div> Your random number generator should produce 32-bit integers.</div> <div> (If 31 bits, left justify by shift-left-one, as some of the</div> <div> tests in DIEHARD favor leading bits.) You should send them to</div> <div> your ascii file in hex form, 8 hex 'digits' per integer,</div> <div> 10 integers per line, no intervening spaces. The ascii file</div> <div> will be twice as big as the binary file it is reduced to.</div> <br> <div> You can see that DIEHARD requires large test files. But they</div> <div> need only be created one at a time, then deleted."</div> <br> <div>The program analyses the "goodness" (randomness) of the *bits* so a 0x3FFFFFF limit is not relevant. Think of it as an 80,000,000 iteration cointoss. </div> <br> <br> <div>At 04:34 PM 02/14/2000 -0400, you wrote:</div> <div>>On Mon, 14 Feb 2000, Brian Broker wrote:</div> <div>></div> <div>>> On Mon, 14 Feb 2000 13:22:01 -0500, Everett Williams wrote:</div> <div>>></div> <div>>> >Has anybody run the Euphoria RNG through the Diehard test?</div> <div>>></div> <div>>> I decided to go ahead and look into this. The Diehard test is looking for</div> <div>>> 32-bit random numbers... The problem with Euphoria's 'rand' function is</div> <div>>> that it will only produce random numbers up to 0x3FFFFFF (instead of</div> <div>>> 0xFFFFFFFF). What would be an acceptable method to obtain the required</div> <div>>> range? Is it acceptable to generate two 16-bit random numbers and</div> <div>>> concatenate them? Does anybody have any other valid suggestions? I could</div> <div>>> try all suggested methods and see what works best...</div> <div>>></div> <div>>> -- Brian</div> <div>>></div> <div>></div> <div>> It would be acceptable to concatenate two 16 bit integers provided</div> <div>>you apply the results of the test only to 'the concatenation of two 16 bit</div> <div>>integers as generated by rand()'. =)</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 & 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> --=====================_14631672==_.ALT--