Exemple #1
0
        public List <int[]> GenerateSequence()
        {
            LotteryTicketPanel lotteryTicketPanel = lotteryDataServices.GetLotteryTicketPanel();

            int[] topDrawnNumbersArr = lotteryDataServices.GetTopDrawnResultDigits().ToArray();

            List <int[]> sequenceArr  = new List <int[]>();
            Random       rnd          = new Random();
            int          breakInfLoop = 0;

            for (int ctr = 0; ctr < GetFieldParamValueForCount(); ctr++)
            {
                breakInfLoop = 0;
                int[] result = new int[lotteryTicketPanel.GetGameDigitCount()];
                while (true)
                {
                    for (int seqCtr = 0; seqCtr < lotteryTicketPanel.GetGameDigitCount(); seqCtr++)
                    {
                        while (true)
                        {
                            int anyDigit    = rnd.Next(0, topDrawnNumbersArr.Length);
                            int pickupDigit = topDrawnNumbersArr[anyDigit];
                            if (!result.Contains(pickupDigit))
                            {
                                result[seqCtr] = pickupDigit;
                                break;
                            }
                            if (breakInfLoop++ > 100000)
                            {
                                break;
                            }
                        }
                    }
                    int sum = 0;
                    foreach (int i in result)
                    {
                        sum += i;
                    }
                    if (sum >= IN_BETWEEN_SUM_MIN && sum <= IN_BETWEEN_SUM_MAX)
                    {
                        break;
                    }
                    result = new int[lotteryTicketPanel.GetGameDigitCount()];

                    if (breakInfLoop++ > 100000)
                    {
                        break;
                    }
                }
                if (breakInfLoop++ > 100000)
                {
                    break;
                }
                Array.Sort(result);
                sequenceArr.Add(result);
            }
            return(sequenceArr);
        }
Exemple #2
0
 private int[] GetBlankSequence()
 {
     int[] betSeq = new int[lotteryTicketPanel.GetGameDigitCount()];
     for (int a = 0; a < lotteryTicketPanel.GetGameDigitCount(); a++)
     {
         betSeq[a] = 0;
     }
     return(betSeq);
 }
        public List <int[]> GenerateSequence()
        {
            LotteryTicketPanel lotteryTicketPanel = lotteryDataServices.GetLotteryTicketPanel();
            List <int[]>       sequenceArr        = new List <int[]>();
            Random             rnd = new Random();

            for (int ctr = 0; ctr < GetFieldParamValueForCount(); ctr++)
            {
                int[] result = new int[lotteryTicketPanel.GetGameDigitCount()];
                while (true)
                {
                    for (int seqCtr = 0; seqCtr < lotteryTicketPanel.GetGameDigitCount(); seqCtr++)
                    {
                        while (true)
                        {
                            int anyDigit = rnd.Next(1, 32);
                            if (anyDigit <= 0)
                            {
                                anyDigit = 1;
                            }
                            if (!result.Contains(anyDigit))
                            {
                                result[seqCtr] = anyDigit;
                                break;
                            }
                        }
                    }
                    int sum = 0;
                    foreach (int i in result)
                    {
                        sum += i;
                    }
                    if (sum >= IN_BETWEEN_SUM_MIN && sum <= IN_BETWEEN_SUM_MAX)
                    {
                        break;
                    }
                    result = new int[lotteryTicketPanel.GetGameDigitCount()];
                }
                Array.Sort(result);
                sequenceArr.Add(result);
            }
            return(sequenceArr);
        }