static public void Print(LotteryCoupon lotteryCoupon, int luckyNumber)
        {
            var sb = new StringBuilder();
            var oldConsoleForegroundColour = Console.ForegroundColor;

            foreach (var row in lotteryCoupon.Rows)
            {
                foreach (int n in row)
                {
                    Console.Write(" ");
                    if (n == luckyNumber)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                    }
                    Console.Write(n);
                    if (n == luckyNumber)
                    {
                        Console.ForegroundColor = oldConsoleForegroundColour;
                    }
                    Console.Write(ExtraPadding(n));
                    Console.Write("|");
                }
                Console.Out.WriteLine("");
            }
        }
 public void SetLuckyLotteryCouponIfNull(LotteryCoupon lotteryCoupon)
 {
     lock (this)
     {
         if (LuckyLotteryCoupon == null)
         {
             LuckyLotteryCoupon = lotteryCoupon;
         }
     }
 }
 public void RefillLotteryCoupon(LotteryCoupon lotteryCoupon)
 {
     for (int r = 0; r < lotteryCoupon.Rows.Count; r++)
     {
         var row = lotteryCoupon.Rows[r];
         for (int c = 0; c < row.Count; c++)
         {
             row[c] = RandomNumberGenerator.Next();
         }
     }
 }
 public bool Check(LotteryCoupon lotteryCoupon)
 {
     if (lotteryCoupon.Rows.Count < 1)
     {
         return(false);  // We choose to consider an empty lottery coupon as unlucky
     }
     foreach (var row in lotteryCoupon.Rows)
     {
         if (!row.Contains(LuckyNumber))
         {
             return(false);
         }
     }
     return(true);
 }
        private static void PrintResult(LotteryCoupon lotteryCoupon, Stopwatch stopwatch, long numberOfAttempts, int numberOfThreads, int luckyNumber)
        {
            LotteryCouponPrinter.Print(lotteryCoupon, luckyNumber);

            PrintExecutionInfo(stopwatch, numberOfAttempts, numberOfThreads);
        }