Article View: sci.math.stat
Article #410Re: Generating a set of random bits
From: Herman Rubin
Date: Wed, 19 Aug 1992 14:44
Date: Wed, 19 Aug 1992 14:44
27 lines
1802 bytes
1802 bytes
In article <36984@sdcc12.ucsd.edu> whart@cs.ucsd.edu (Bill Hart) writes:
>I have an application for which I need to generate a random 'vector' of
>bits of length N. I have looked at stuff in Numerical Recipies for
>generating a random sequence of bits, but it remains unclear whether
>such a generator would be appropriate for generating a random
>vector of bits.
>I need/want to have the distribution of vectors remain 'random'. Right
>now I'm generating a random float in [0,1> and testing to see
>if it is less than 0.5 or not. This works, but I'm sure there is
>a better way of doing this.
>Any ideas or pointers?
I would suggest using a long-gap shift-register procedure, using
XOR or + (if full word integer addition is possible). By long-gap,
I mean something like using the n-406 and the n-607 words to get
the n-th word. If the appropriate length seed (here 607 words) is
something like physically generated (or even the noise from usenet
news), the individual bits should be fairly good, at least after a
few runs to hand initial bias.
--
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
Phone: (317)494-6054
hrubin@pop.stat.purdue.edu (Internet, bitnet)
{purdue,pur-ee}!pop.stat!hrubin(UUCP)
Technical Details
Message-ID:
<57248@mentor.cc.purdue.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!centerline!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubinReferences:
<36984@sdcc12.ucsd.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!centerline!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin From: hrubin@pop.stat.purdue.edu (Herman Rubin) Newsgroups: sci.math.stat Subject: Re: Generating a set of random bits Message-ID: <57248@mentor.cc.purdue.edu> Date: 19 Aug 92 14:44:11 GMT References: <36984@sdcc12.ucsd.edu> Sender: news@mentor.cc.purdue.edu Organization: Purdue University Statistics Department Lines: 27