GameRandom
namespace Griff;
public sealed class GameRandom : RandomRandom numbers that a rewind takes back: the same sequence new Random(seed) gives (Knuth’s subtractive generator, as .NET has always made it from a seed), with where it has got to kept in fields of its own, so a rewind snapshot keeps it and putting the game back puts the numbers back too. Each game has one (what Rand draws on); a component or a script that wants numbers of its own, seeded (a board dealt the same way every time), keeps one in a field.
Methods
Section titled “Methods”public GameRandom Copy()A copy that gives the same numbers from here on, without drawing on this one.
public override int Next()public override int Next(int maxValue)public override int Next(int minValue, int maxValue)NextBytes
Section titled “NextBytes”public override void NextBytes(byte[] buffer)NextBytes
Section titled “NextBytes”public override void NextBytes(Span<byte> buffer)NextDouble
Section titled “NextDouble”public override double NextDouble()NextInt64
Section titled “NextInt64”public override long NextInt64()NextInt64
Section titled “NextInt64”public override long NextInt64(long maxValue)NextInt64
Section titled “NextInt64”public override long NextInt64(long minValue, long maxValue)NextSingle
Section titled “NextSingle”public override float NextSingle()Reseed
Section titled “Reseed”public void Reseed(int seed)Starts again from seed.
Sample
Section titled “Sample”protected override double Sample()Unseeded
Section titled “Unseeded”public static GameRandom Unseeded()A new sequence from a seed of its own, different each time.