コード例 #1
0
        private void numberToGenerate()
        {
            fivenumbers = new List <int>();
            var time = DateTime.Now.ToString("HHmmss");
            var seed = Convert.ToInt32(time);

            seedGenerator = new LinearRandomNumber(1233);
            var random = new Random(seedGenerator.Next(seed));
            var number = random.Next(1, 69);

            while (fivenumbers.Count < 5)
            {
                if (doesNumberExist(number, fivenumbers))
                {
                    time = DateTime.Now.ToString("HHmmss");
                    seed = Convert.ToInt32(time);
                    var modular = seed % 30;
                    seedGenerator = new LinearRandomNumber(modular);
                    random        = new Random(seedGenerator.Next(seed));
                    number        = random.Next(1, 69);
                }
                else
                {
                    fivenumbers.Add(number);
                    number = random.Next(1, 69);
                }
            }
        }
コード例 #2
0
        public List <PowerBall> GenerateList(int count)
        {
            seedGenerator = new LinearRandomNumber(count);

            for (int i = 0; i < count; i++)
            {
                ListGenerated.Add(generateNumber());
            }
            return(ListGenerated);
        }