Skip to content

Instantly share code, notes, and snippets.

@stedolan
Created April 28, 2020 16:00
Show Gist options
  • Save stedolan/c8f6c54f532242d34121c040a0ab1d5a to your computer and use it in GitHub Desktop.
Save stedolan/c8f6c54f532242d34121c040a0ab1d5a to your computer and use it in GitHub Desktop.
(* See https://dornsifecms.usc.edu/assets/sites/520/docs/VonNeumann-ams12p36-38.pdf *)
let u () = Random.float 1.
let rec exp () =
let x = u () and y = u () in
if f x y then x else exp () +. 1.
and f x y = x < y || g (u ()) y
and g x y = x < y && f x (u ())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment