From: scott@helsbreth.org (Scott Nelson) Subject: Re: obtaining proper input for DIEHARD rng tests Date: Thu, 06 Jan 2000 22:57:53 GMT Newsgroups: sci.math Summary: [missing] On 6 Jan 2000 peterw@ugcs.caltech.edu (Peter T. Wang) wrote: >Hi everyone, > >This is perhaps a bit off-topic, Nonsense. I've been told by a number of people that sci.math is the proper place to discuss the science of randomness and all that goes with it. How could all those knowledgable netizens be wrong? > I am interested in using DIEHARD (the >random-number generator testing program) to, well, test some pseudorandom >numbers.... Unfortunately I am not much of a programmer so getting the >data into a proper format so that it may be read for testing is a bit too >tricky; if anyone can point me in the right direction, I'd be most >appreciative! > If you're using a PC, (or can compile a C program) you should look at DiehardC, a C version of DIEHARD. Available via anonymous ftp at; ftp://ftp.helsbreth.org/pub/helsbret/random/ Even if you can't use the program, the extra documentation provided is probably worth it. Of particular interest to you, The asc2bin program has been completely rewritten and now accepts numbers of 8, 16, or 32 bits, in hex, decimal or floating point. See http://www.helsbreth.org/random/diehard.html for a full description of the differences between the two programs. Scott Nelson ============================================================================== From: whuber@quantdec.com (William A. Huber) Subject: Re: Revised. Help: Multiply two distributions with Monte Carlo? Date: Thu, 28 Dec 2000 18:34:20 GMT Newsgroups: sci.stat.math,sci.math On Thu, 28 Dec 2000 01:09:54 GMT, Ray and Lynne Vickson wrote: >... how do you know you can trust the random number generator in EXCEL, >or even in a commercial add-on? Have you tested the generator? If not, >have you seen results of such tests? Excel 95's RAND() function *fails* many of G. Marsaglia's "Diehard" tests. See a discussion and summary, with references, at http://www.quantdec.com/arcview.htm. (I have appended the summary to this message for your convenience.) The results for Excel are tabulated about 60% of the way down the page. Incidentally, I believe the "ArcView" generator discussed on that page--which passes all but one of the Diehard tests after it is suitably adjusted--may be derived from a generator built into Windows NT 4.0. --Bill Huber Quantitative Decisions Appendix: Extract from http://www.quantdec.com/arcview.htm. (The reference to the RAND algorithm in the last line is a hyperlink to http://support.microsoft.com/support/kb/articles/q86/5/23.asp, which claimsRAND() has a period of only "1 million different numbers.") The failure of Excel's RAND() function is particularly dramatic. To do the tests, a spreadsheet was filled in all 256 columns through row 5024 with the formula INT(2^32 * RAND()). This was calculated and saved as tab-delimited ASCII. It was recalculated and saved again as tab-delimited ASCII to a separate file. These files were concatenated to produce a file with 256 * 5024 * 2 random values in the range 0..2^32-1. The following AWK program converted this output into the packed hexadecimal format needed for Diehard to process: # # Input: lines of 256 random 32-bit integers in base 10 # Output: lines of 80 hex characters. # NB: Might omit up to the last 9 values. # BEGIN { T31 = 2^31 # Saves a little computation time } { for (i=1; i<=NF; i++) { s = s sprintf("%-8.8x", $i-T31) # Flipping the high bit prevents overflow during conversion to hex. if (++j >= 10) { print s s = "" j = 0 } } } The nature of the test failure is particularly awful: the frequencies of "1"s in bits 0-2 and 29-31 of the output were significantly different from the frequencies of "0"s, so the output is non-uniform! One possible fix is to use the fractional part of 8*RAND() instead of RAND() itself, which effectively rejects bits 0-2 and starts the values with bit 3. I have not tested this, in part because the algorithm used for RAND() (which Microsoft has published) is poor, so there's really not much hope. ============================================================================== From: geeker@my-deja.com Subject: Re: Revised. Help: Multiply two distributions with Monte Carlo? Date: Thu, 28 Dec 2000 23:25:29 GMT Newsgroups: sci.stat.math,sci.math In article <3a4b851c.2713652@news1.rdc2.pa.home.com>, whuber@quantdec.com wrote: > On Thu, 28 Dec 2000 01:09:54 GMT, Ray and Lynne Vickson > wrote: > >... how do you know you can trust the random number generator in EXCEL, > >or even in a commercial add-on? Have you tested the generator? If not, > >have you seen results of such tests? > > Excel 95's RAND() function *fails* many of G. Marsaglia's "Diehard" > tests. See a discussion and summary, with references, at > http://www.quantdec.com/arcview.htm Furthermore, the overall numerical performance of Excel is dreadful. Some scathing reviews have appeared in the literature; see for instance McCullough and Wilson, "On the accuracy of statistical procedures in Microsoft Excel 97," Computational Statistics and Data Analysis 31 (1999), 27-37. Amusing reading, if a little depressing... Sent via Deja.com http://www.deja.com/