codewars / runner

Issue tracker for Code Runner
34 stars 8 forks source link

Setting random seed automatically in the Lua output handler #312

Closed slashOwO closed 4 months ago

slashOwO commented 4 months ago

Is your feature request related to a problem? Please describe. In Lua, math.random() always generates the same number if a random seed is not set.

Describe the solution you'd like Add math.random(os.time()) to the Lua output handler.

hobovsky commented 4 months ago

Related: https://www.codewars.com/kumite/66854a3e1939adaa91ba1923?sel=66854a3e1939adaa91ba1923#6688340c51371d9f8ab7e87e

hobovsky commented 4 months ago

Codewars uses Busted in pretty much normal way, and does no custom things when running Busted tests except using the Codewars reporter for Busted. So the expectation is that Busted tests run on CW behave pretty much the same as Busted tests run outside of CW. It is true that CW output handler does not set the random seed, but:

Can you please make double sure that outside of CW, when no additional command line parameters are used, the random seed is set by the runner?

slashOwO commented 4 months ago

I did some more testing and found out that the Lua interpreter I am using (Lua 5.4) sets the random seed, not busted. Sorry.