using SptCommon.Annotations; using Core.Models.Utils; using Core.Utils; namespace Core.Helpers; [Injectable] public class ProbabilityHelper( ISptLogger _logger, RandomUtil _randomUtil ) { /// /// Chance to roll a number out of 100 /// /// Percentage chance roll should success /// scale of chance to allow support of numbers > 1-100 /// true if success public bool RollChance(double chance, double scale = 1) { return _randomUtil.GetInt(1, (int)(100 * scale)) / (1 * scale) <= chance; } }