Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a splittable random number generator #86

Closed
jmid opened this issue Nov 19, 2019 · 2 comments
Closed

Add a splittable random number generator #86

jmid opened this issue Nov 19, 2019 · 2 comments

Comments

@jmid
Copy link
Collaborator

jmid commented Nov 19, 2019

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,

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:
xavierleroy/pringo#2

@c-cube
Copy link
Owner

c-cube commented Nov 19, 2019

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…

@jmid
Copy link
Collaborator Author

jmid commented Nov 7, 2022

Closing this as completed since OCaml5 comes with a new, splittable LXM PRNG (ocaml/ocaml#10742)

@jmid jmid closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants