-
Notifications
You must be signed in to change notification settings - Fork 4
4. Custom
Venomaus edited this page Dec 22, 2023
·
4 revisions
A bunch of custom classes are also provided, which could be useful for modding.
Provides a Random implementation of which you can export the full state of the random, and initialize a new random with this state. This is useful when you need to serialize the random, and later deserialize it into the same random where you want your randomness to remain the same.
It works similar to the .net Random, (Next, NextDouble) methods are available.
Note: the minValue and maxValue are both always "inclusive".
var random = new MersenneTwisterRandom(seed); // if no seed provided uses DateTime.Now.Ticks as seed
var state = random.SaveState(); // Get the save state
random = new MersenneTwisterRandom(state); // Restore a new random with the same state