Date: Mon, 13 Sep 2010 20:26:08 -0700
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: how to generate 1 to 100k random numbers without zeros?
Content-Type: text/plain; charset=utf-8
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Viel, Kevin
> Sent: Monday, September 13, 2010 3:00 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: how to generate 1 to 100k random numbers without zeros?
> > -----Original Message-----
> > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> > Nordlund, Dan (DSHS/RDA)
> > Sent: Monday, September 13, 2010 4:08 PM
> > To: SAS-L@LISTSERV.UGA.EDU
> > Subject: Re: how to generate 1 to 100k random numbers without zeros?
> > I apparently missed this thread until now. Just a couple of
> > 1. There was a question below of whether or not the ranuni() function
> > return a zero. It will not.
> According to the documentation:
> "The RANUNI function returns a number that is generated from the
> uniform distribution on the interval (0,1)"
> Indeed, (0,1) does not include 0 and 1. However, this is inconsistent
> with the uniform distribution as I know it, which includes its
> endpoints, so I wonder if it should not be [0,1]. The probability of
> selecting *any* point or set of points is zero, but it *can* happen.
> In the case of the later, I suspect that the *limit* could be non-zero.
> For instance, one could devise a infinite number of points, but still
> not create intervals, whether open or close.
> We could do something akin to the search for the next largest prime,
> that is each of us select a distinct non-zero seed and generate
> RANUNI() streams until a zero is encountered. :)
> Or SI could chime in and tell use the actual RNG specifications :)
The SAS documentation does give the actual specification. I also give the specification on sasCommunity.org
Software implemented pseudo-RNGs are always discrete, so any given random number generated by the RNG has a non-zero probability. Whether it is problematic that the SAS uniform RNG generates numbers on an open interval depends on what you need to do with those random numbers.
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204