daqana / dqrng

Fast Pseudo Random Number Generators for R

Home Page:https://daqana.github.io/dqrng/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A note of appreciation

LTLA opened this issue · comments

Just a note of appreciation for making this nice package - saved me some trouble packaging up the pcg headers myself. CRAN doesn't record reverse dependencies to BioC packages, but here they are:

https://www.bioconductor.org/packages/devel/bioc/html/DropletUtils.html
https://www.bioconductor.org/packages/devel/bioc/html/scran.html

This being an issue, I guess I should complain about something; so, could we get the latest versions of the PCG C++ headers? There's a couple of small changes to what's currently available in dqrng.

Actually, I do also have another idea that you might be interested in.

Currently, PCG32 (and many of the other PRNGS) require 64 bits for seeding. However, if we were to pass a random R integer, we would only ever get 32 bits. This could cause some biases with respect to being limited to a small portion of the state space of the PRNG, as discussed here for MT19937. I can imagine that this could cause statistical problems in applications involving lots of reseeding.

I'm not a PRNG expert so I don't know how much this would be true of the PRNGs provided by dqrng, but we can avoid this problem at the source by passing 64 bits of entropy from R to seed any PRNGs in the C++ code. This is achieved with use of randomly chosen raw vectors to define a similarly random uint64_t seed. If this is of interest, I have an implementation of this in my fork.

Thanks for the kind words! I have updated the PCG headers now.

Concerning improvements w.r.t. seeding: Could you open a separate issue for this? Thanks.