Skip to content

Instantly share code, notes, and snippets.

@gnomex
Last active December 29, 2016 00:11
Show Gist options
  • Save gnomex/3f2760094c185bca4ff2935cc144f795 to your computer and use it in GitHub Desktop.
Save gnomex/3f2760094c185bca4ff2935cc144f795 to your computer and use it in GitHub Desktop.
# first option
list = for n <- 1..60, do: n
list |> Enum.shuffle |> Enum.take(6)
# second option (using same list defined before)
Enum.take_random(list, 6)
# third option
(for n <- 1..60, do: n) |> Enum.shuffle |> Enum.take(6)
# nested option
Enum.take_random((for n <- 1..60, do: n), 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment