Background and motivation
Perhaps, while people can choose to use new System.Random() or System.Random.Shared, let it be possible to choose which implementation we are going to use, for example let people do new System.Random.Xorshiro()
Currently the actual name for the Xor shift rotation implementation in System.Random is XoshiroImpl and it's an internal class
I personally get something out of this if I can use specifically the flavor I'd like for my rng, because it's now possible to System.Random.Xorshiro().Seed(State), Initializing it with a state that was maybe extracted from State property
API Proposal
public sealed class XorShiro: ImplBase
{
...
public void Seed(){}
public static Random Seed(State state){}
public State State (){}
}
API Usage
var automaticAlgorithm = System.Random.Shared;
var manualAlgorithm = System.Random.XorShiro.Seed( :Span / number / state);
var state = manualAlgorithm.State;
for (var i = 0; i < 3; i++) manualAlgorithm.Next(); //1,1,1
var restore = System.Random.XorShiro.Seed(state);
for (var i = 0; i < 3; i++) restore.Next(); //1,1,1
Alternative Designs
Have people implement their own rng
Risks
No response
Background and motivation
Perhaps, while people can choose to use
new System.Random()orSystem.Random.Shared, let it be possible to choose which implementation we are going to use, for example let people donew System.Random.Xorshiro()Currently the actual name for the Xor shift rotation implementation in System.Random is
XoshiroImpland it's an internal classI personally get something out of this if I can use specifically the flavor I'd like for my rng, because it's now possible to
System.Random.Xorshiro().Seed(State), Initializing it with a state that was maybe extracted fromStatepropertyAPI Proposal
API Usage
Alternative Designs
Have people implement their own rng
Risks
No response