elm-community/random-extra/3.2.0

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. Takes O(n log n) time and no extra space.

choices : Int -> List a -> Generator ( List a, List a )

Repeated sample without replacement: produce a list of randomly selected elements of some list, and the list of unselected elements.