Re: [Rd] [R] RNG Cycle and Duplication (PR#12538)

From: <>
Date: Thu, 14 Aug 2008 23:05:09 +0200 (CEST)

Shengqiao Li wrote:
> Hello all,
> I am generating large samples of random numbers. The RNG help page says:
> "All the supplied uniform generators return 32-bit integer values that are
> converted to doubles, so they take at most 2^32 distinct values and long

> runs will return duplicated values." But I find that the cycles are not
> the same as the 32-bit integer.


This is no bug. Cycle length and the set of possible values are different concepts.

And please don't cross-post.

Duncan Murdoch
> My test indicated that the cycles for Knuth's methods were 2^30 while
> Wichmann-Hill's cycle was larger than 2^32! No numbers were duplicated in
> 10M numbers generated by runif using Wichmann-Hill. The other three
> methods had cycle length of 2^32.

> So, anybody can explain this? And any improvement to the
> implementation can be made to increase the cycle length like the

> Wichmann-Hill method?
> ========================================
> Shengqiao Li
> Research Associate
> The Department of Statistics
> West Virginia University
> Morgantown, WV 26506-6330
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
> mailing list Received on Thu 14 Aug 2008 - 21:08:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Aug 2008 - 21:36:59 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive