Closed Jengamon closed 4 months ago
PUC-Lua has different behavior if math.random(0) is executed, as 0 is not in [1, n) for any n. This changes the code to match that behavior.
math.random(0)
Also fixes the crash from math.random(v) where v < 0 and makes it a Lua error.
math.random(v)
v
I poked the function until it cried, so I included a fix for math.random([n, ]math.maxinteger)...
math.random([n, ]math.maxinteger)
Yeah, this seems right to me, thank you!
PUC-Lua has different behavior if
math.random(0)
is executed, as 0 is not in [1, n) for any n. This changes the code to match that behavior.Also fixes the crash from
math.random(v)
wherev
< 0 and makes it a Lua error.I poked the function until it cried, so I included a fix for
math.random([n, ]math.maxinteger)
...