From 4839c12340c1b449028d3f22f6d6e39d4cea01d7 Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 12 Feb 2024 02:04:58 +0100 Subject: [PATCH] Add RandomValueWithinLimits to IntegerRange --- CShocker/Ranges/IntegerRange.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CShocker/Ranges/IntegerRange.cs b/CShocker/Ranges/IntegerRange.cs index de975f0..a121970 100644 --- a/CShocker/Ranges/IntegerRange.cs +++ b/CShocker/Ranges/IntegerRange.cs @@ -16,6 +16,11 @@ public readonly struct IntegerRange return value >= this.Min && value <= this.Max; } + public int RandomValueWithinLimits() + { + return Random.Shared.Next(this.Min, this.Max); + } + internal string RangeString() { return $"{this.Min}-{this.Max}";