Extra randomized functions on arrays.
array : Basics.Int -> Random.Generator a -> Random.Generator (Array a)
Generate a random array of given size given a random generator
randomLength5IntArray =
array 5 (int 0 100)
rangeLengthArray : Basics.Int -> Basics.Int -> Random.Generator a -> Random.Generator (Array a)
Generate a random array of random length given a minimum length and a maximum length.
sample : Array a -> Random.Generator (Maybe a)
Sample with replacement: produce a randomly selected element of the
array, or Nothing
for an empty array. Takes O(1) time.
choose : Array a -> Random.Generator ( Maybe a, Array a )
Sample without replacement: produce a randomly selected element of the
array, and the array with that element omitted (shifting all later elements
down). If the array is empty, the selected element will be Nothing
.
shuffle : Array a -> Random.Generator (Array a)
Shuffle the list. Takes O(n log n) time and no extra space.