Exemple #1
0
        public void TestGetRandom()
        {
            var numbers = new int[] { 1, 2, 3, 4, 5 };
            var probs   = new double[] { 1, 2, 0, 2, 1 };

            var k = Enumerable.Range(0, 100).Select(s => Expendator.GetRandomNumberFromArrayWithProbabilities(numbers, probs)).ToArray();

            var k1 = k.Count(p => p == numbers[0]);
            var k2 = k.Count(p => p == numbers[1]);
            var k3 = k.Count(p => p == numbers[2]);
            var k4 = k.Count(p => p == numbers[3]);
            var k5 = k.Count(p => p == numbers[4]);

            $"".Show();
        }