Re: Random bits (generation)

*To*: mathgroup at smc.vnet.net*Subject*: [mg35120] Re: [mg35045] Random bits (generation)*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Tue, 25 Jun 2002 03:42:35 -0400 (EDT)*References*: <200206210354.XAA08580@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

"DIAMOND Mark R." wrote: > > I am not sure whether anyone other than a Wolfram guru will know the answer > to this. ... > > (1) If I wish to generate a large number of random bits, what is the fastest > way? > (2) What is the safest way in the sense of being able to expect the bit > sequence to pass Marsaglia's Diehard battery of tests Maurer's Universal > Statistical Test.? or is this requirement impossible to meet with Random? > > More specifically, to be sure that they are independent and random, should I > use something like Random[Integer, {0,1}] or can one use *all the bits* of, > say, Random[Integer, {0,2^32-1}] ... or even something larger. > > Cheers, > > Mark Diamond Probably best just to generate random bits using e.g. randomBits[length_] := Table[Random[Integer], {length}] This is reasonably fast and will give high quality random sequence. You might get better speed by generating a bigger number and then extracting bits, but you then run the risk of having a less "random" sequence. More information as to what methods are used under what circumstances may be found at: http://library.wolfram.com/mathgroup/archive/2000/May/msg00088.html Among other things it is noted at that link that the method above should pass all the DIEHARD tests. Daniel Lichtblau Wolfram Research

**References**:**Random bits (generation)***From:*"DIAMOND Mark R." <dot@dot.dot>