コード例 #1
0
        private static void CheckSimpleFloats()
        {
            List <float> list = Autotests_RandomNumbers.RandomFloats(500).ToList <float>();

            if (list.Any((float x) => x < 0f || x > 1f))
            {
                Log.Error("Float out of range.", false);
            }
            if (list.Any((float x) => x < 0.1f))
            {
                if (list.Any((float x) => (double)x > 0.5 && (double)x < 0.6))
                {
                    if (list.Any((float x) => (double)x > 0.9))
                    {
                        goto IL_C7;
                    }
                }
            }
            Log.Warning("Possibly uneven distribution.", false);
IL_C7:
            list = Autotests_RandomNumbers.RandomFloats(1300000).ToList <float>();
            int num = list.Count((float x) => (double)x < 0.1);

            Log.Message("< 0.1 count (should be ~10%): " + (float)num / (float)list.Count <float>() * 100f + "%", false);
            num = list.Count((float x) => (double)x < 0.0001);
            Log.Message("< 0.0001 count (should be ~0.01%): " + (float)num / (float)list.Count <float>() * 100f + "%", false);
        }
コード例 #2
0
        private static void CheckSimpleFloats()
        {
            List <float> list = Autotests_RandomNumbers.RandomFloats(500).ToList();

            if (list.Any((float x) => x < 0.0 || x > 1.0))
            {
                Log.Error("Float out of range.");
            }
            if (!list.Any((float x) => x < 0.10000000149011612) || !list.Any((float x) => (double)x > 0.5 && (double)x < 0.6) || !list.Any((float x) => (double)x > 0.9))
            {
                Log.Warning("Possibly uneven distribution.");
            }
            list = Autotests_RandomNumbers.RandomFloats(1300000).ToList();
            int num = list.Count((float x) => (double)x < 0.1);

            Log.Message("< 0.1 count (should be ~10%): " + (float)((float)num / (float)list.Count() * 100.0) + "%");
            num = list.Count((float x) => (double)x < 0.0001);
            Log.Message("< 0.0001 count (should be ~0.01%): " + (float)((float)num / (float)list.Count() * 100.0) + "%");
        }