diff --git a/Lottery/Generator.cs b/Lottery/Generator.cs
index 5703f59..cdfb055 100644
--- a/Lottery/Generator.cs
+++ b/Lottery/Generator.cs
@@ -3,16 +3,16 @@
internal class Generator
{
///
- /// Simple algorithm for generating a list of unique numbers of Limits.Count size
+ /// Simple algorithm for generating a list of unique numbers of sample.Count size.
///
- /// Defines the amount of numbers to generate, the min and max values
+ /// Defines the sample size as well as the upper and lower bounds.
/// Numbers are returned as a sorted set.
- public static SortedSet Generate(Limits limits)
+ public static SortedSet Generate(Sample sample)
{
- List candidates = [.. Enumerable.Range(limits.Lower, limits.Upper)];
+ List candidates = [.. Enumerable.Range(sample.Lower, sample.Upper)];
SortedSet numbers = [];
- for (int i = 0; i < limits.Count; i++)
+ for (int i = 0; i < sample.Count; i++)
{
int RandomIndex = Random.Shared.Next(candidates.Count);
numbers.Add(candidates[RandomIndex]);
diff --git a/Lottery/Lottery.cs b/Lottery/Lottery.cs
index e61ad26..6721639 100644
--- a/Lottery/Lottery.cs
+++ b/Lottery/Lottery.cs
@@ -1,15 +1,15 @@
namespace Lottery
{
- internal record Limits(int Count, int Lower, int Upper);
+ internal record Sample(int Lower, int Upper, int Count);
///
/// Abstract base class for lotteries.
- /// Limits property must be overridden.
+ /// Sample property must be overridden.
///
internal abstract class Lottery
{
- protected virtual Limits Limits => throw new NotImplementedException();
- public virtual string Play() => $"Numbers: {string.Join(", ", Generator.Generate(Limits))}";
+ protected virtual Sample Sample => throw new NotImplementedException();
+ public virtual string Play() => $"Numbers: {string.Join(", ", Generator.Generate(Sample))}";
}
///
@@ -18,24 +18,24 @@
///
internal class LottoLottery : Lottery
{
- protected override Limits Limits { get; } = new(Count: 6, Lower: 1, Upper: 59);
+ protected override Sample Sample { get; } = new(Lower: 1, Upper: 59, Count: 6);
}
///
/// Abstract base class for Lotteries with Special values.
/// It subclasses Lottery.
- /// SpecialLimits and SpecialIdentifier properties must be overridden.
+ /// SpecialSample and SpecialIdentifier properties must be overridden.
///
internal abstract class LotteryWithSpecial : Lottery
{
- protected virtual Limits SpecialLimits => throw new NotImplementedException();
+ protected virtual Sample SpecialSample => throw new NotImplementedException();
protected virtual string SpecialIdentifier => throw new NotImplementedException();
public override string Play()
{
return string.Join("\n", [
- $"Numbers: {string.Join(", ", Generator.Generate(Limits))}",
- $"{SpecialIdentifier}: {string.Join(", ", Generator.Generate(SpecialLimits))}",
+ $"Numbers: {string.Join(", ", Generator.Generate(Sample))}",
+ $"{SpecialIdentifier}: {string.Join(", ", Generator.Generate(SpecialSample))}",
]);
}
}
@@ -46,8 +46,8 @@
///
internal class EuroMillionsLottery : LotteryWithSpecial
{
- protected override Limits Limits { get; } = new(Count: 5, Lower: 1, Upper: 50);
- protected override Limits SpecialLimits { get; } = new(Count: 2, Lower: 1, Upper: 12);
+ protected override Sample Sample { get; } = new(Lower: 1, Upper: 50, Count: 5);
+ protected override Sample SpecialSample { get; } = new(Lower: 1, Upper: 12, Count: 2);
protected override string SpecialIdentifier => "Lucky Stars";
}
@@ -57,8 +57,8 @@
///
internal class SetForLifeLottery : LotteryWithSpecial
{
- protected override Limits Limits { get; } = new(Count: 5, Lower: 1, Upper: 47);
- protected override Limits SpecialLimits { get; } = new(Count: 1, Lower: 1, Upper: 10);
+ protected override Sample Sample { get; } = new(Lower: 1, Upper: 47, Count: 5);
+ protected override Sample SpecialSample { get; } = new(Lower: 1, Upper: 10, Count: 1);
protected override string SpecialIdentifier => "Life Ball";
}
@@ -68,8 +68,8 @@
///
internal class ThunderballLottery : LotteryWithSpecial
{
- protected override Limits Limits { get; } = new(Count: 5, Lower: 1, Upper: 39);
- protected override Limits SpecialLimits { get; } = new(Count: 1, Lower: 1, Upper: 14);
+ protected override Sample Sample { get; } = new(Lower: 1, Upper: 39, Count: 5);
+ protected override Sample SpecialSample { get; } = new(Lower: 1, Upper: 14, Count: 1);
protected override string SpecialIdentifier => "Thunderball";
}
}