lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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