/// <summary> /// Initializes a new instance of the <see cref="LotteryHandler"/> class. /// </summary> /// <param name="lotteryType"> /// The lottery type. /// </param> /// <param name="userName"> /// The user name. /// </param> /// <param name="isUseGoogleSheet"> /// The is use google sheet. /// </param> /// <param name="isUseEarlierStatistic"> /// The is use earlier statistic. /// </param> public LotteryHandler(Enums.LotteryType lotteryType, string userName, bool isUseGoogleSheet, bool isUseEarlierStatistic) { LotteryType = lotteryType; UserName = userName; lotteryRule = new LotteryRule(lotteryType); DownloadNumbersFromInternet(lotteryRule.DownloadLink); GenerateSections(); if (isUseGoogleSheet) { GoogleSheetData = new GoogleSheetData(UserName); LoadNumbersFromSheet(GoogleSheetData.GetData()); if (isUseEarlierStatistic) { MakeStatisticFromEarlierWeek(); } } }
/// <summary> /// The get random number. /// </summary> /// <param name="lotteryRule"> /// The lottery Rule. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> public static int GetRandomNumber(LotteryRule lotteryRule) { Random random = new Random(); return(random.Next(lotteryRule.MinNumber, lotteryRule.MaxNumber + 1)); }