How can I make it so the same sequence of random numbers come out of an MSVC++ program and a C# .NET program?
Is it possible? Is there any relationship between MSVC++ rand() and System.Random?
Given the example below it seems they are totally different.
#include <iostream> using namespace std; int main() { srand( 1 ) ; cout << rand() << endl << rand() << endl << rand() << endl ; }
using System; class Program { static void Main( string[] args ) { Random random = new Random( 1 ); Console.WriteLine( random.Next() ); Console.WriteLine( random.Next() ); Console.WriteLine( random.Next() ); } }