lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Just noticed on Lua 5.1, on a 32-bit machine, math.random(0,
0x7FFFFFFF) always returns a negative number:
> return math.random(0, 0x7FFFFFFF)

0x7FFFFFFE has no such issue. 0x80000000 and up give an error which is
a bit nonsensical, but I at least understand why:
> return math.random(0, 0x80000000)
stdin:1: bad argument #2 to 'random' (interval is empty)

Sent from my Game Boy.