Single and Range wrappers for minimal PCG PRNG

General FreeBASIC programming questions.
Posts: 845
Joined: Jan 02, 2017 0:34
Location: UK

Re: Single and Range wrappers for minimal PCG PRNG

Postby deltarho[1859] » Sep 11, 2017 12:01

When I read the pcg paper it was not clear to me whether the sequence number, referred to as increment by O'Neill, had an upper limit of < 2^63 or < 2^64 so I played it safe by using < 2^63; effectively halving the number of sequences from 2^64 to 2^63.

O'Neill's blog, last entry 20 August 2017, fleshes out some aspects of pcg and it appears that the upper limit is, in fact, < 2^64. There is a restriction in that the sequence number must be odd. This is ensured by 'this.seq Or 1' in the code. If this.seq is odd the 'this.seq Or 1' is redundant. If this.seq is even then 'this.seq Or 1' makes it odd. Disallowing even numbered, halves, obviously, the total number of sequences that we can use. So, my statement about a key length of 127 bits per round is still true.

In the Sub pcg32.MyRandomize there are two instances of Get64Bit\2. They can now be changed to Get64Bit. We now have 0 <= seq <= 2^64 - 1. In use seq will be >= 1 by virtue of 'this.seq Or 1'.

Strictly speaking when I refer to different sequences - I should be referring to different streams.

All that my miss-reading did was to put an earlier block on how many steams we could use.

By the way the blog is a good read - that is where I found out that O'Neill is heavily into using PractRand now.

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest