-
It looks to me like fast-check uses jump() between runs to ensure each run is independent, but elsewhere it just uses clone(). Wouldn’t this result in correlation between arbitraries within the same run? For example, suppose you create two streams, one after the other? I’m wondering if the random number generator should have a fork() operation that creates independent child streams. It seems like initializing the seeds of the child RNG with random numbers generated by the parent might work? For background, here’s an article about the issues generating random numbers for games: A primer for repeatable random numbers. This paper is about a technique used for making parallel random number generators on GPU’s by using counters and hash functions: Parallel Random Numbers: As Easy as 1, 2, 3 (PDF) Edit: I tried it and it does seem to be pretty non-random. See #5054 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
After chasing some references, I found out how JAX does it: They advocate splittable RNGs, and here's the paper for that (from 2013): Splittable Pseudorandom Number Generators using Cryptographic Hashing (PDF) The first author is Koen Claessen, who is also the first author of the QuickCheck paper. And they describe in the paper how a similar bug happened in QuickCheck:
|
Beta Was this translation helpful? Give feedback.
As you pointed out, there is currently a bug causing distinct streams of values produced during the same iteration to be quite similar (offset by N).
We used to have the same issue years ago but between distinct runs and with all arbitraries. At that time our strategy has been to come up with classical tooling around PRNG by relying on jumps. Unfortunately we missed streams (will be fixed soon, I just need to find a short window to fix and test it).
So far, the plan is to stick with jumps. It remains a usual way to make draws independent from each other's. It's a key need for the arbitraries: one arbitrary should not impact another one after the generate. In other words once created strea…