public Range Min/Max

This commit is contained in:
glax 2024-01-17 20:57:53 +01:00
parent f469cb5a04
commit e6ca0a3823
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@
<Authors>Glax</Authors>
<RepositoryUrl>https://github.com/C9Glax/CShocker</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>1.1.4</Version>
<Version>1.1.5</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -2,7 +2,7 @@
public abstract class RandomIntegerRange
{
public Range _range { get; init; }
public Range Range { get; init; }
internal RandomIntegerRange(Range range, Range limits)
{
if (range.Max - range.Min < 0)
@ -11,11 +11,11 @@ public abstract class RandomIntegerRange
throw new ArgumentOutOfRangeException(nameof(limits.Min), "Min has to be withing Range 0-100");
if (range.Max < limits.Min || range.Max > limits.Max)
throw new ArgumentOutOfRangeException(nameof(range.Max), "Max has to be withing Range 0-100");
this._range = range;
this.Range = range;
}
public int GetRandomRangeValue()
{
return Random.Shared.Next(_range.Min, _range.Max);
return Random.Shared.Next(Range.Min, Range.Max);
}
}