Add a splittable random number generator
An increasing number QuickCheck implementations build on splittable random number generators to avoid (pseudo-random) dependencies between the seeds passed to, e.g., a pair generator's two component generators. For example,
- Core's QuickCheck implementation: https://github.com/janestreet/core_kernel/blob/master/src/quickcheck.ml
- Haskell's QuickCheck implementation: https://github.com/nick8325/quickcheck/blob/master/Test/QuickCheck/Random.hs
- The Haskell Hedgehog implementation: https://github.com/hedgehogqa/haskell-hedgehog
- The F# Hedgehog implementation: https://github.com/hedgehogqa/fsharp-hedgehog/blob/master/src/Hedgehog/Seed.fs
- ...
In this light QCheck should consider building on one as well. For OCaml a few splittable random number generator implementations are already available. Here's an OCaml implementation from Core: https://github.com/janestreet/splittable_random Here's another one for OCaml by Xavier: https://github.com/xavierleroy/pringo There may however be different reasons (dependencies, license, opam-package availability, ...) to write one from scratch instead of going with one of these.
Note, apparently there was a bug in the original SplitMix paper Guy L. Steele Jr., Doug Lea, and Christine H. Flood Fast Splittable Pseudorandom Number Generators, OOPSLA 2014. that made it into a number of implementations - and described in more detail in this blog post: http://www.pcg-random.org/posts/bugs-in-splitmix.html A kind soul has since filed bug-reports to the different implementations, e.g., here: https://github.com/xavierleroy/pringo/issues/2
It'd be quite annoying to have to leave Random.State.t :(
It breaks every existing use of qcheck and is more complicated from the go.
Is there any chance one could build on top of Random? I don't know enough about random generators sadly…
Closing this as completed since OCaml5 comes with a new, splittable LXM PRNG (ocaml/ocaml#10742)