Files
tbd-station-14/Content.Shared/EntityTable/ValueSelector/RangeNumberSelector.cs
ArtisticRoomba 6c2c5935ed fix RangeNumberSelector to actually be inclusive (#36155)
* fix RangeNumberSelector to actually be inclusive

* Convert all random number stuff to randomint and prune unused code

* another heisentest???

* another heisentest after a heisentest. im going to lose it.
2025-04-14 17:02:49 -04:00

18 lines
516 B
C#

namespace Content.Shared.EntityTable.ValueSelector;
/// <summary>
/// Gives a value between the two numbers specified, inclusive.
/// </summary>
public sealed partial class RangeNumberSelector : NumberSelector
{
[DataField]
public Vector2i Range = new(1, 1);
public override int Get(System.Random rand)
{
// rand.Next() is inclusive on the first number and exclusive on the second number,
// so we add 1 to the second number.
return rand.Next(Range.X, Range.Y + 1);
}
}