[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PRNG for Lua 4.0?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 11 Sep 2013 17:27:28 +0200
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