예제 #1
0
        public string RandomFromList(List<string> list)
        {
            NumberGenerator num = new NumberGenerator();

            // Pick random names from the beginning to end of the lists.
            int number = num.GenerateNumber(0, list.Count - 1);

            return list[number];
        }
예제 #2
0
        public DateTime GenerateDate(int lowDay, int lowMonth, int lowYear, 
                                     int highDay, int highMonth, int highYear)
        {
            NumberGenerator Num = new NumberGenerator();

            DateTime lowDate = new DateTime(lowYear, lowMonth, lowDay);
            DateTime highDate = new DateTime(highYear, highMonth, highDay);

            int dayDiff = (highDate - lowDate).Days;
            int randomDayDiff = Num.GenerateNumber(0, dayDiff);

            return lowDate.AddDays(randomDayDiff);
        }