I am looking for a function that will return a seed of C# Random
class based on the first two int numbers produced by Random.Next()
. I would like to avoid brute force (this is what I tried). Essentially, I am looking for a reverse function for this code, that is not based on brute force
using System;
public class Program
{
public static void Main()
{
int seed = 0;
Random rnd = new Random(seed);
Console.WriteLine($"Seed: {seed}");
Console.WriteLine($"Rnd1: {rnd.Next()}");
Console.WriteLine($"Rnd2: {rnd.Next()}");
}
}
Which prints out
Seed: 0
Rnd1: 1559595546
Rnd2: 1755192844
Is there a fast way to obtain Seed
given Rnd1
and Rnd2
?