Skip to content

Instantly share code, notes, and snippets.

@JefClaes
Created December 7, 2014 20:03
Show Gist options
  • Select an option

  • Save JefClaes/3da63f8b74fae5031b5f to your computer and use it in GitHub Desktop.

Select an option

Save JefClaes/3da63f8b74fae5031b5f to your computer and use it in GitHub Desktop.
Spinning the wheel in F#: manipulating the odds (2)
let rng = new Random()
let random (rng : Random) virtualIndexes =
virtualIndexes |> Seq.nth (rng.Next(0, virtualIndexes |> Seq.length))
let spin physicalWheel virtualIndexes rng =
physicalWheel |> Seq.nth (random rng virtualIndexes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment