[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Am I misunderstanding random numbers?
- From: Geoff Leyland <geoff_leyland@...>
- Date: Wed, 17 Mar 2010 07:18:03 +1300
On 17/03/2010, at 6:54 AM, Javier Guerra Giraldez wrote:
> On Tue, Mar 16, 2010 at 11:17 AM, Christopher Eykamp <email@example.com> wrote:
>> I'm running on Windows, embedded in a C++ app. The chances of a re-seed
>> seem minimal, as the two lines I posted are executed one after the other in
>> the same file.
>> I have temporarily resolved my problem by overwriting the random function to
>> call my C++ program and use it's random function, which seems to be...
>> well... random.
>> If the seeds were the same, I would expect the results I see, but they're
>> clearly different.
> i've just tried this:
> function tr(seed)
> math.randomseed( seed )
> print ("Seed: "..seed,
> for _,s in ipairs
On windows I got the same results as Christopher.
Lua just uses the system's rand, and what you're learning is that rand isn't a great random number generator, and that Windows' implementation is not the best. lhf's lrandom is surely better: http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/