elm-community/random-extra/2.0.0

NOTE: this package is not compatible with Elm 0.19.1

Random.List

Extra randomized functions on lists.

Work with a List

choose : List a -> Generator ( Maybe a, List a )

Sample without replacement: produce a randomly selected element of the list, and the list with that element omitted. If the list is empty, the selected element will be Nothing.

shuffle : List a -> Generator (List a)

Shuffle the list using the Fisher-Yates algorithm. Takes O(n log n) time and O(n) additional space.