How often should I call `math.randomseed(os.time())` in the lua module?

I might as well ask since it’s been bothering me for some time, how often should I call math.randomseed(os.time()) in the lua module?

So basically, is the randomizer object (and its seed) shared globally or also per-match like other variables in the lua module?

I’m currently calling it at the start of every match, should it be called once for the whole server instead? Or the opposite, once per turn?

You should call it once per match. Each match is bound to an isolated Lua runtime instance and shares no state with other matches. If you want to seed the random number generator it should be done once per match, probably in the match_init call makes most sense.

1 Like

Thank I’m doing that now but just wanted to make sure. <3