elm-community / random-extra / Random.Set

Extra randomized functions on sets.

Create a Set

set : Basics.Int -> Random.Generator comparable -> Random.Generator (Set comparable)

Generate a set of at most the given size from a generator.

The size of a generated set is limited both by the integer provided and the number of unique values the generator can produce. It is very likely, but not guaranteed, that generated sets will be as big as the smaller of these two limits.

Create a Generator

sample : Set comparable -> Random.Generator (Maybe comparable)

Select a value from a set uniformly at random, or Nothing for an empty set. Analogous to Random.Extra.sample but with sets.

Modify a Generator

notInSet : Set comparable -> Random.Generator comparable -> Random.Generator comparable

Filter a generator of all values not in a given set.