[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why is the first random number after randomseed() not random?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 19 Mar 2007 15:26:52 -0300
> The Lua Wiki Math Library Tutorial page[1] says:
> "But beware! The first random number you get is not really 'randomized'
> (at least in Windows 2K and OS X)."
That's the way Pseudorandom number generators usually work. See
http://en.wikipedia.org/wiki/Pseudo-random_number_generator
To fix that, start your program with
math.randomseed(os.time())
for instance.
--lhf