CatStation/Content.Shared/EntityTable/ValueSelector/ConstantNumberSelector.cs
Whatstone f339f58945
Replace all uses of System.Random with IRobustRandom, resolve all System.Random warnings. (#32)
* Remove all uses of System.Random

* Use IRobustRandom in BinomialNumberSelector.Get

* Remove remaining ToolRefinableSystem S.Random inst
2026-06-16 23:38:37 +00:00

33 lines
617 B
C#

using Robust.Shared.Random;
namespace Content.Shared.EntityTable.ValueSelector;
/// <summary>
/// Gives a constant value.
/// </summary>
public sealed partial class ConstantNumberSelector : NumberSelector
{
[DataField]
public int Value = 1;
public ConstantNumberSelector(int value)
{
Value = value;
}
public override int Get(IRobustRandom rand)
{
return Value;
}
public override float Odds()
{
// You really shouldn't have a constant value of 0 ever.
return 1;
}
public override float Average()
{
return Value;
}
}