2014-03-27 15:25 GMT+04:00 Mike Pall <mike-1403@xxxxxxxxxx>: > Nope, that operation is completely predictable. > Cool, thanks! > Ok, so it throws away a couple of bits, of course. But then ... > there's no guarantee that different seeds will generate a > different sequence, anyway. > I believe that probability of getting same sequences from different high-quality pseudo random seeds must be low. Or I do not know something about PRNG used in LuaJIT? > For your use case it might be best to use a dedicated PRNG that > isn't global like math.random(). Then you have full control over > the seeding process etc. Most PRNGs can be implemented quite > efficiently with the FFI and the 64 bit bit operations available > in LuaJIT 2.1. Or you could just call an existing C implementation > via the FFI. > We have a sandboxed execution environment and client code can not call math.randomseed directly. I decided to use LuaJIT's PRNG because it's simple and my tests indicate that it's determenistic, when seeded from 64bit integer. We can later on switch to custom PRNG if the needed. Thanks for your help, Mike! -- Regards, Konstantin