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

View File

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