Beispiel #1
0
            public static RandomGeneratorFlat MinMax(int min, int max)
            {
                RandomGeneratorFlat ret = new RandomGeneratorFlat();

                ret.min = min;
                ret.max = max;
                return(ret);
            }
Beispiel #2
0
        void GenerateMoviesData()
        {
            XPCollection <Movie> dbMovies = new XPCollection <Movie>(session);

            movies = new MovieData[dbMovies.Count];
            RandomGeneratorNoRepetitions mappedMovieGenerator = RandomGeneratorFlatNoRepetitions.MinMax(0, movies.Length - 1);

            for (int i = 0; i < movies.Length; ++i)
            {
                movies[i] = new MovieData(dbMovies[i]);
                movies[i].LostItemsCountGenerator   = RandomGeneratorFlat.MinMax(0, 5);
                movies[i].DamageItemsCountGenerator = RandomGeneratorFlat.MinMax(0, 5);
                moviesMap.Add(i, mappedMovieGenerator.Next());
            }
            movieGenerator          = new RandomGeneratorGaussNoRepetitions(0, movies.Length - 1);
            lostDamageTimeGenerator = RandomGeneratorFlat.MinMax(9 * 3600 + 1800, 18 * 3600 + 1800);
        }
Beispiel #3
0
        void GenerateCustomersData()
        {
            XPCollection <Customer> dbCustomers = new XPCollection <Customer>(session);

            customers = new CustomerData[dbCustomers.Count];
            for (int i = 0; i < customers.Length; ++i)
            {
                customers[i] = new CustomerData(dbCustomers[i]);
            }
            RandomGenerator averInterPointsTermGenerator = new RandomGeneratorFlat(4, 0);

            foreach (CustomerData customer in customers)
            {
                if (customer.DBCustomer.FirstName == "Essie")
                {
                    customer.LastDayRentsCount = 4;
                    customer.OverdueDaysCountLastDayGenerator = new RandomGeneratorFiveState(-1, 4, 3, 2, 2, 1);
                }
                else
                {
                    customer.OverdueDaysCountLastDayGenerator = new RandomGeneratorFiveState(-1, 2, 6, 4, 3, 0);
                }
                if (customer.DBCustomer.Photo == null)
                {
                    customer.SellsCountGenerator  = RandomGeneratorFlat.MinMax(3, 7);
                    customer.MovieFormatGenerator = new RandomGeneratorFiveState(0, 50, 10, 40, 0, 0);
                }
                else
                {
                    customer.SellsCountGenerator  = RandomGeneratorFlat.MinMax(10, 15);
                    customer.MovieFormatGenerator = new RandomGeneratorFiveState(0, 60, 30, 10, 0, 0);
                }
                customer.InterPointsTermGenerator    = new RandomGeneratorFlat(averInterPointsTermGenerator.Next(), 3);
                customer.MoviesForRentCountGenerator = new RandomGeneratorFiveState(0, 70, 5, 20, 5, 0);
                customer.OverdueDaysCountGenerator   = new RandomGeneratorFiveState(-2, 1, 2, 18, 2, 0);

                customer.SellsInReceiptCountGenerator = RandomGeneratorFlat.MinMax(1, 2);
                customer.ReceiptTimeGenerator         = RandomGeneratorFlat.MinMax(9 * 3600 + 1800, 18 * 3600 + 1800);
            }
        }
Beispiel #4
0
 void GenerateAddedItemsCounts()
 {
     addedItemsCountGenerators[formatsIndexes[MovieItemFormat.DVD]]     = RandomGeneratorFlat.MinMax(2, 4);
     addedItemsCountGenerators[formatsIndexes[MovieItemFormat.BlueRay]] = RandomGeneratorFlat.MinMax(2, 4);
     addedItemsCountGenerators[formatsIndexes[MovieItemFormat.VideoCD]] = RandomGeneratorFlat.MinMax(1, 2);
 }
Beispiel #5
0
 private RandomGeneratorFlatNoRepetitions(bool minMax, int min, int max)
     : base(RandomGeneratorFlat.MinMax(min, max))
 {
 }