Enum.shuffle
You're seeing just the function
shuffle
, go back to Enum module for more information.
Specs
Returns a list with the elements of enumerable
shuffled.
This function uses Erlang's :rand
module to calculate
the random value. Check its documentation for setting a
different random algorithm or a different seed.
Examples
The examples below use the :exsss
pseudorandom algorithm since it's
the default from Erlang/OTP 22:
# Although not necessary, let's seed the random algorithm
iex> :rand.seed(:exsss, {1, 2, 3})
iex> Enum.shuffle([1, 2, 3])
[3, 2, 1]
iex> Enum.shuffle([1, 2, 3])
[2, 1, 3]