Skip to content

Instantly share code, notes, and snippets.

@monkieboy
Last active April 15, 2016 19:16
Show Gist options
  • Save monkieboy/0479320280f40b6d67c333ab76575e71 to your computer and use it in GitHub Desktop.
Save monkieboy/0479320280f40b6d67c333ab76575e71 to your computer and use it in GitHub Desktop.
let genHand : Gen<Hand> =
let deck =
gen {
let! seed = Gen.choose (0, 100000)
let deck = shuffle newDeck seed
return deck }
gen {
let! (ShuffledDeck d) = deck
let hand =
d
|> List.take 5
return hand }
// Shorter
let genHand : Gen<Hand> =
gen {
let! seed = Gen.choose (0, 100000)
let deck = shuffle newDeck seed
let (ShuffledDeck d) = deck
return d |> List.take 5 }
// Even shorter :-)
let genHand : Gen<Hand> =
gen {
let! seed = Gen.choose (0, 100000)
let (ShuffledDeck deck) = shuffle newDeck seed
return deck |> List.take 5 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment