orNull

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> Arbitrary<T>.orNull(nullProbability: Double): Arbitrary<T?>

Create a new arbitrary of the same type but inject null values with a probability of nullProbability.

This is a type-safe version of Arbitrary.injectNull().

Return

a new arbitrary instance

Parameters

nullProbability

the probability. ≥ 0 and ≤ 1.