|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, this lua code led to a crash:
local pcg = PcgRandom(42)
local value = pcg:next()
This was because if you called s32 PcgRandom::range(min, max) with the
minimum and maximum possible values for s32 integers (which the lua
binding code did), u32 PcgRandom::range(bound) got called with 0 as the
bound. The bound however is one above the maximum value, so 0 is a "special"
value to pass to this function. This commit fixes the lua crash by
assigning the RNG's full range to the bound 0, which is also fits to the
"maximum is bound - 1" principle, as (u32)-1 is the maximum value in the
u32 range.
|