[Solved] C# Random number unique first number


Generally, I don’t think there is any requirement that pseudorandom generators should generate unique numbers given unique seeds.

The only think it happens is that, given a seed, the generator will always generate the same number sequence (obtained by calling multiple times the next method) and the sequence will repeat at some point.
However, the C# Random class uses a subtractive generation algorithm, where the next random number is generated basing on previous numbers of the sequence. Hence, there may be some kind of dependency between the number and the seed, which makes the random number generator to generate unique numbers every time the seed is changed.

If you want to be sure, either try it yourself with seeds from int.MinValue to int.MaxValue, or check the C# implementation here
https://referencesource.microsoft.com/#mscorlib/system/random.cs

solved C# Random number unique first number