private static int GetSum(string value) { int sum = 0; for (int i = 0; i < 10; i++) { sum += int.Parse(value[i].ToString()) * PisRule.CalculateWeight(i); } return(sum); }
private static int[] GenerateNumbers() { List <int> generatedNumbers = new List <int>(); int total = 0; for (int i = 0; i < 10; i++) { generatedNumbers.Add(_random.Next(10)); total += generatedNumbers[generatedNumbers.Count - 1] * PisRule.CalculateWeight(i); } generatedNumbers.Add(PisRule.CalculateLastDigit(total)); return(generatedNumbers.ToArray()); }