[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.4.2 error with math.randomseed
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 11 Dec 2020 14:55:53 -0300
> On Fri, Dec 11, 2020 at 2:33 PM Luiz Henrique de Figueiredo
> <lhf@tecgraf.puc-rio.br> wrote:
> >
> > > Except that math.randomseed(os.clock()) is not working. It does not like that clock as parameter.
> >
> > What error message do you get?
>
> I guess Antonio should use os.time instead of os.clock.
Note that, even in Lua 5.3, math.randomseed(os.clock()) does not raise
an error, but it probably does not do what you want. If you call that in
the beginning of the program, 'os.clock()' will return a small fraction
that will always be rounded to zero, so that math.random produces the
same numbers at every run.
-- Roberto