Generating the same sequence of random C# with Example
numbers over and over again When creating Random instances with the same seed, the same numbers will be generated. int seed = 5; for (int i = 0; i < 2; i++) { Console.WriteLine("Random instance " + i); Random rnd = new Random(seed); for (int j = 0; j < 5; j++) { Console.Write(rnd.Next()); Console.Write(" "); } Console.WriteLine(); } Output: Random instance 0 726643700 610783965 564707973 1342984399 995276750 Random instance 1 726643700 610783965 564707973 1342984399 995276750