[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Am I misunderstanding random numbers?
- From: Lee Hickey <lahickey@...>
- Date: Tue, 16 Mar 2010 18:13:54 +0000
On Windows XP with Lua 5.1.3, I get precisely the same values as in
Christopher's original message.
On 16 March 2010 18:10, KHMan <email@example.com> wrote:
> Javier Guerra Giraldez wrote:
>> On Tue, Mar 16, 2010 at 11:17 AM, Christopher Eykamp 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
>>> the same file.
>>> I have temporarily resolved my problem by overwriting the random function
>>> 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
>> and i get:
>> Seed: 3063121584 2331 1179 6134 7741
>> Seed: 2428144928 9074 3329 5507 8307
>> Seed: 3559301251 1739 4278 5885 8691
>> Seed: 4287790062 6352 1754 759 588
>> Seed: 2737803158 5587 8387 1486 6766
>> Seed: 2458923424 4302 7992 5852 5221
>> i guess that your Lua's math.random() is not stock Lua's. if it were,
>> we should get the same numbers given the same seeds.
>> can other members try this and see if everybody gets exactly the same
>> random numbers? this is Kubuntu 9.04 x86_64 with Lua 5.1.4 default
> Got a bunch of different numbers with Lua 5.1.4 on Cygwin 1.7 and Lua 5.1.4
> on MinGW.
> Hard to believe it's a Lua problem...
> Kein-Hong Man (esq.)
> Kuala Lumpur, Malaysia