예제 #1
0
        public static void Prepare(
            List <int> equityChanges, List <int> bondChanges, List <int> billChanges,
            Distro distroEquities, Distro distroBonds, Distro distroBills,
            Object printlock)
        {
            int[] cases = { 1, 2, 3 };
            var   res1  = Parallel.ForEach(
                cases,
                (t) =>
            {
                List <int> testValues = new List <int>();
                Distro distroTest     = new Distro(Globals.Singleton().Bins);
                switch (t)
                {
                case 1:
                    Distro.PrepareDistribution(
                        equityChanges, distroEquities,
                        Globals.Singleton().Bins, "DistroEquities.csv", printlock);
                    break;

                case 2:
                    Distro.PrepareDistribution(
                        bondChanges, distroBonds,
                        Globals.Singleton().Bins, "DistroBonds.csv", printlock);
                    break;

                case 3:
                    Distro.PrepareDistribution(
                        billChanges, distroBills,
                        Globals.Singleton().Bins, "DistroBills.csv", printlock);
                    break;
                }
            });
        }
예제 #2
0
        public static void Test(
            Distro distroEquities, Distro distroBonds, Distro distroBills,
            Object printlock)
        {
            int[] tests = { 1, 2, 3 };
            var   res1  = Parallel.ForEach(
                tests,
                (t) =>
            {
                List <int> testValues = new List <int>();
                Distro distroTest     = new Distro(Globals.Singleton().Bins);
                switch (t)
                {
                case 1:
                    for (int i = 0; i < 10000000; i++)
                    {
                        testValues.Add((int)(distroEquities.Play() * Utils.PercentageScale));
                    }
                    Distro.PrepareDistribution(
                        testValues, distroTest,
                        Globals.Singleton().Bins, "testEq.csv", printlock);
                    break;

                case 2:
                    for (int i = 0; i < 10000000; i++)
                    {
                        testValues.Add((int)(distroBonds.Play() * Utils.PercentageScale));
                    }
                    Distro.PrepareDistribution(
                        testValues, distroTest,
                        Globals.Singleton().Bins, "testBo.csv", printlock);
                    break;

                case 3:
                    for (int i = 0; i < 10000000; i++)
                    {
                        testValues.Add((int)(distroBills.Play() * Utils.PercentageScale));
                    }
                    Distro.PrepareDistribution(
                        testValues, distroTest,
                        Globals.Singleton().Bins, "testBi.csv", printlock);
                    break;
                }
            });
        }