Exemplo n.º 1
0
    public static void Main(string[] args)
    {
        var mt = new MT19937();

        mt.Seed(new ulong[] { 0x12345UL, 0x23456UL, 0x34567UL, 0x45678UL });

        var i = 0;

        foreach (ulong want in expectedInt)
        {
            var have = mt.UInt64();
            if (have != want)
            {
                Console.WriteLine("wrong output {0}: {1} != {2}", i, have, want);
                return;
            }
            i++;
        }

        i = 0;
        foreach (string want in expectedReal)
        {
            var have = mt.Real2().ToString("0.00000000");
            if (have != want)
            {
                Console.WriteLine("wrong output {0}: {1} != {2}", i, have, want);
                return;
            }
            i++;
        }

        Console.WriteLine("done");
    }