-
Notifications
You must be signed in to change notification settings - Fork 1
Custom RNG
Ricky Setiawan edited this page Jul 12, 2022
·
1 revision
You can create your own RNG. It's easy to set up.
public class LitdexRNG : Random64
{
}
public class LitdexRNG : Random64
{
private ulong _seed;
}
public class LitdexRNG : Random64
{
private ulong _seed;
public LitdexRNG(ulong seed)
{
this._seed = seed;
}
}
4. Override the Next()
method. This is the internal state of RNG's and the place you implement your algorithm.
public class LitdexRNG : Random64
{
private ulong _seed;
public LitdexRNG(ulong seed)
{
this._seed = seed;
}
protected override ulong Next()
{
var a = (this._seed >> 11) | (this._seed << (32 - 11));
this._seed = a * 951879;
return this._seed;
}
}
public class LitdexRNG : Random64
{
private ulong _seed;
public LitdexRNG(ulong seed)
{
this._seed = seed;
}
protected override ulong Next()
{
var a = (this._seed >> 11) | (this._seed << (32 - 11));
this._seed = a * 951879;
return this._seed;
}
public override string AlgorithmName()
{
return "LitdexRNG";
}
}