klyn.math.Random.randRange
method
public static randRange(min as FLOAT_TYPE, max as FLOAT_TYPE) as FLOAT_TYPE
Description

Returns a random value in [min, max).

Parameters
ParameterDescription
minFinite lower bound.
maxFinite upper bound.
Returns

A random value greater than or equal to min and strictly lower than max, or min when both bounds are equal.

Throws
  • ValueException if a bound is not finite or max is lower than min.
Example
speed = Random.randRange(0.5, 2.0)
assert 0.5 <= speed < 2.0
print(speed)
wide = Random.randRange(-1e308, 1e308)
assert -1e308 <= wide < 1e308