[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Re: Math.Random() always returns 0**
**From**: Luiz Henrique de Figueiredo <lhf@...>
**Date**: Wed, 24 May 2006 08:44:30 -0300

> Have you configured Lua to use integer math? I seem to remember there
> was a flaw in Lua 5 that stopped random numbers from working properly
> with integer types, and I've not checked to see if it was fixed in 5.1.
Almost the whole math library does not make sense if lua_Number is int.
The only exceptions are abs, max, min, random (with args), randomseed.
For integer math, other functions such as idiv (quotient+remainder),
gcd, ipow, and support for modular arithmetic are probably what is needed.
I think they should go into a separate library.
--lhf