[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 5.4.2 error with math.randomseed
- From: decuant <decuant@...>
- Date: Fri, 11 Dec 2020 18:28:54 +0000
Roberto and Sergio,
the fix math.randomseed(os.time()) did work.
I misused the clock() function, expecting the ticks from the operating system start, not the application.
As a result, as Roberto points, I'm most probably passing a value of 0 or close to 0, useless as you said.
The funny thing is that I don't even use anything random, just that I use skeletons from app to app, so code was there for no use.
Much fast support, do you sleep anytime?
Antonio de Curtis
Sent with ProtonMail Secure Email.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, December 11, 2020 6:55 PM, Roberto Ierusalimschy <email@example.com> wrote:
> > On Fri, Dec 11, 2020 at 2:33 PM Luiz Henrique de Figueiredo
> > firstname.lastname@example.org 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