fromEnumWeighted

inline fun <E : Enum<E>> ArbExtensionPoint.fromEnumWeighted(crossinline weightProvider: (E) -> Int): ArbArgsGenerator<E>(source)

Returns an ArbArgsGenerator for the given Enum of type E where the given weightProvider defines the weight for each entry of the enum.

See mergeWeighted for an explanation of the weights. Note, if you want equal probability for each entry, then use arb. fromEnum<T>() instead.

Since

2.2.0

Parameters

weightProvider

A function which defines a weight for each entry of E.

E

the Enum type which shall be transformed into an ArbArgsGenerator.

Throws

in case a weight is wrong (is less than 1)

in case the weights sum up to Int.MAX_VALUE or more.