I am migrating a method that is used for decoding from .NET Framework 1.1 to .NET Framework 4. I noticed that implementation of Random changed. So given the same seed, Random.NextBytes returns different result.
So if I run the following code.
byte[] bytes = new byte[4];
System.Random random = new System.Random(50);
random.NextBytes(bytes);
for(int i=0; i< bytes.Length; i++)
{
Console.WriteLine("bytes[" + i + "] = " + bytes[i]);
}
Under .NET Framework 1.1 it returns:
bytes[0] = 216
bytes[1] = 124
bytes[2] = 183
bytes[3] = 58
Under .NET framework 4 it returns:
bytes[0] = 154
bytes[1] = 49
bytes[2] = 183
bytes[3] = 48
What is the best way to resolve this problem?