Compare commits

..

No commits in common. "e9ca7677655e24dc8b66385d4c0772f19bdae6b2" and "8224684ddc4348e0112af229c8b8be8351dd8ef4" have entirely different histories.

2 changed files with 12 additions and 11 deletions

View File

@ -5,20 +5,21 @@
/// <summary>
/// Simple algorithm for generating a list of unique numbers of Limits.Count size
/// </summary>
/// <param name="limits">Defines the amount of numbers to generate, the min and max values</param>
/// <returns>Numbers are returned as a sorted set.</returns>
public static SortedSet<int> Generate(Limits limits)
/// <param name="Limits">Defines the amount of numbers to generate, the max and min values</param>
/// <returns>The list of numbers is returned sorted in ascending order.</returns>
public static List<int> Generate(Limits Limits)
{
List<int> candidates = Enumerable.Range(limits.Lower, limits.Upper).ToList();
SortedSet<int> numbers = [];
List<int> Candidates = Enumerable.Range(Limits.Lower, Limits.Upper).ToList();
List<int> Numbers = [];
for (int i = 0; i < limits.Count; i++)
for (int i = 0; i < Limits.Count; i++)
{
int RandomIndex = Random.Shared.Next(candidates.Count);
numbers.Add(candidates[RandomIndex]);
candidates.RemoveAt(RandomIndex);
int RandomIndex = Random.Shared.Next(Candidates.Count);
Numbers.Add(Candidates[RandomIndex]);
Candidates.RemoveAt(RandomIndex);
}
return numbers;
Numbers.Sort();
return Numbers;
}
}
}

View File

@ -1,7 +1,7 @@
namespace Lottery
{
/// <summary>
/// Represents the kinds of lottery supported
///
/// </summary>
enum KindOfLottery : int
{