random

fun IntRange.random(random: Random): Int

Returns a random element from this range using the specified source of randomness.

This overload allows passing a java.util.Random instance so, for instance, MathUtils.random may be used. Results are undefined for an empty range, and there is no error checking.


Returns a pseudo-random, uniformly distributed Float value from MathUtils.random's sequence, bounded by this range.

Results are undefined for an empty range, and there is no error checking. Note that endInclusive is treated as exclusive as it is not practical to keep it inclusive.