lua-users home
lua-l archive

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


> 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