Builtin Library
README.md
NumberRange
Uniform random [min, max] value type, a sibling of NumberSequence and
ColorSequence.
Construct
NumberRange.new(v) -- constant range (min == max == v)
NumberRange.new(min, max) -- random range; reversed bounds auto-ascend
Use
local r = NumberRange.new(0.5, 2.0)
print(r.min, r.max) -- 0.5 2.0
print(r:sample()) -- uniform random in [0.5, 2.0]
Design notes
The API is a .new constructor and a :sample() draw, the
constructor-first, :sample-named discipline NumberSequence and
ColorSequence keep (PR #3460), so the three value types read as one API.
Issue: #2674.