kotest-assertions / io.kotest.properties / choose

choose

fun Gen.Companion.choose(min: Int, max: Int): Gen<Int>
Deprecated: Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0. Use Arb.ints(min, max)

Returns a stream of values, where each value is a random Int between the given min and max.

fun Gen.Companion.choose(min: Long, max: Long): Gen<Long>
Deprecated: Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0. Use Arb.longs(min, max)

Returns a stream of values, where each value is a Long between the given min and max.

fun <T : Any> Gen.Companion.choose(a: Pair<Int, T>, b: Pair<Int, T>, vararg cs: Pair<Int, T>): Gen<T>
Deprecated: Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0. Use Arb.choose(a, b, c, ...)

Returns a stream of values based on weights:

Gen.choose(1 to 'A', 2 to 'B') will generate 'A' 33% of the time and 'B' 66% of the time.

Exceptions

IllegalArgumentException - If any negative weight is given or only weights of zero are given.