jeudi 2 juillet 2020

Is there any non-global seeded random in LUA?

Is there any non-global method of generating a seeded random number in LUA?

The function math.randomseed() sets the seed for the whole application (which is less than ideal) and if the code is executed async there is a risk that other parts of the application "steals" numbers from the sequence.

One good example from C# is the Random class where you can initialize a Random instance with a seeded number rather than setting the seed for the whole application: https://docs.microsoft.com/en-us/dotnet/api/system.random.-ctor?view=netcore-3.1




Aucun commentaire:

Enregistrer un commentaire