From 1598ffef99678810063bc5a9a8fe8e34c8fca49d Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 22 Apr 2022 09:15:11 +0100 Subject: [PATCH] Use Lerp for Random.NextDouble --- X10D/src/RandomExtensions/RandomExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/X10D/src/RandomExtensions/RandomExtensions.cs b/X10D/src/RandomExtensions/RandomExtensions.cs index 447cf99..3ff23ed 100644 --- a/X10D/src/RandomExtensions/RandomExtensions.cs +++ b/X10D/src/RandomExtensions/RandomExtensions.cs @@ -1,5 +1,6 @@ using System.Globalization; using System.Text; +using X10D.Math; namespace X10D; @@ -108,7 +109,7 @@ public static class RandomExtensions throw new ArgumentOutOfRangeException(ExceptionMessages.MaxValueGreaterThanEqualToMinValue); } - return (random.NextDouble() * (maxValue - minValue)) + minValue; + return MathUtility.Lerp(minValue, maxValue, random.NextDouble()); } ///