[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PRNG for Lua 4.0?
- From: Michael Horvath <mikh2161@...>
- Date: Wed, 11 Sep 2013 20:57:46 -0400
Thanks for the help everyone!
On Wed, Sep 11, 2013 at 11:27 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2013/9/11 Michael Horvath <mikh2161@gmail.com>:
>
>> function mul16(a, b)
>> local a_lo, b_lo = mod(a, 2^8), mod(b, 2^8)
>> local a_hi, b_hi = a - a_lo, b - b_lo
>> return mod(a_lo * b_lo + mod(a_lo * b_hi, 2^16) + mod(a_hi * b_lo,
>> 2^16) + mod(a_hi * b_hi, 2^16), 2^16)
>> end
>
> Yes, that's simplest. Any generator that works with 16-bit integers
> (and that used to be standard) will work with this.
>
- References:
- PRNG for Lua 4.0?, Michael Horvath
- Re: PRNG for Lua 4.0?, Michael Horvath
- Re: PRNG for Lua 4.0?, Dirk Laurie
- Re: PRNG for Lua 4.0?, Michael Horvath
- Re: PRNG for Lua 4.0?, Dirk Laurie
- Re: PRNG for Lua 4.0?, Michael Horvath
- Re: PRNG for Lua 4.0?, Michael Horvath
- Re: PRNG for Lua 4.0?, Thijs Schreijer
- Re: PRNG for Lua 4.0?, Michael Horvath
- Re: PRNG for Lua 4.0?, Doug Currie
- Re: PRNG for Lua 4.0?, Michael Horvath
- Re: PRNG for Lua 4.0?, Dirk Laurie