elm-community/random-extra/3.1.0

NOTE: the latest version is 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 using the Union-Find data structure with path compression algorithm. Takes O(n log n) space and time.