lua-users home
lua-l archive

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

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.


PS I read the article on LCGs, and I assume this to mean that Lua uses one of these. I didn't see much in there that would explain why different seeds would end up producing similar streams of random numbers.

On 3/16/2010 3:17 AM, Javier Guerra Giraldez wrote:
On Tue, Mar 16, 2010 at 3:54 AM, Christopher Eykamp<>  wrote:
When I run the following snippet, I get unexpected results.  About 50% of
the results are the same (I've omitted the different ones from my results
list, because they're not as interesting :-)

math.randomseed( __randomSeed )
print ("Seed: ".. __randomSeed,
are you sure the RNG isn't 'reseeded' before the call to print() ?
what platform are you using?

on two _very_ different platforms (a kubuntu Linux x86_64 and an
embedded MIPS box) i get consistent results with same seeds, but not
the values you're seeing there.