[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Getting randomic integers
- From: Doug Currie <doug.currie@...>
- Date: Sun, 17 Jan 2010 17:26:45 -0500
On Jan 17, 2010, at 2:59 PM, Wolfgang Pupp wrote:
> Btw., is there some decent, "resumable"- RNG for Lua around?
How many pseudorandom values do you need? If this is for simple testing, or for a game, then you may not a very complex RNG. For example, the well know Park & Miller "minimal standard" linear congruential generator has a cycle of 2147483647 values and is quite suitable for some forms of testing and simple games. It is a one-liner:
function pmrng (x) return math.fmod(x * 16807, 2147483647) end
where x is the seed.
e
- References:
- Re: Getting randomic integers, Gé Weijers
- Re: Getting randomic integers, startx
- Re: Getting randomic integers, Majic
- Re: Getting randomic integers, startx
- Re: Getting randomic integers, Klaus Ripke
- Re: Getting randomic integers, Luiz Henrique de Figueiredo
- Re: Getting randomic integers, Klaus Ripke
- Re: Getting randomic integers, Rob Kendrick
- Re: Getting randomic integers, Erik Lindroos
- Re: Getting randomic integers, Klaus Ripke
- Re: Getting randomic integers, Wolfgang Pupp