コード例 #1
0
ファイル: 32vs64.cs プロジェクト: l1183479157/coreclr
    static int Main(string[] args)
    {
        int i;
        int countZero = 0;
        // Create a Mersenne Twister with seed 123456
        RandomTwister64 rand = new RandomTwister64(123456);
        //Print 100 doubles
        for (i = 1; i <= 100; i++)
        {
            double d = rand.RandomDoubleClosed();

            if (d == 0.0)
                countZero++;

            Console.Write(String.Format("{0} ", d));
            if (i % 5 == 0)
                Console.WriteLine();
        }

        // NOTE: When I reproed this, I got 100 zeros (0)
        // in the unfixed case, and some double between
        // 0 and 1 in the fixed case. Actually never saw 
        // the 0 or the 1, always a double in between. 
        if (countZero < 2)
        {
            Console.WriteLine("!!!!!!! PASSED !!!!!!!");
            return 100;
        }
        else
        {
            Console.WriteLine("!!!!!!! FAILED !!!!!!!");
            return 666;
        }
    }
コード例 #2
0
    static int Main(string[] args)
    {
        int i;
        int countZero = 0;
        // Create a Mersenne Twister with seed 123456
        RandomTwister64 rand = new RandomTwister64(123456);

        //Print 100 doubles
        for (i = 1; i <= 100; i++)
        {
            double d = rand.RandomDoubleClosed();

            if (d == 0.0)
            {
                countZero++;
            }

            Console.Write(String.Format("{0} ", d));
            if (i % 5 == 0)
            {
                Console.WriteLine();
            }
        }

        // NOTE: When I reproed this, I got 100 zeros (0)
        // in the unfixed case, and some double between
        // 0 and 1 in the fixed case. Actually never saw
        // the 0 or the 1, always a double in between.
        if (countZero < 2)
        {
            Console.WriteLine("!!!!!!! PASSED !!!!!!!");
            return(100);
        }
        else
        {
            Console.WriteLine("!!!!!!! FAILED !!!!!!!");
            return(666);
        }
    }