Use Lerp for Random.NextDouble

This commit is contained in:
Oliver Booth 2022-04-22 09:15:11 +01:00
parent f961530962
commit 1598ffef99
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
using X10D.Math;
namespace X10D; namespace X10D;
@ -108,7 +109,7 @@ public static class RandomExtensions
throw new ArgumentOutOfRangeException(ExceptionMessages.MaxValueGreaterThanEqualToMinValue); throw new ArgumentOutOfRangeException(ExceptionMessages.MaxValueGreaterThanEqualToMinValue);
} }
return (random.NextDouble() * (maxValue - minValue)) + minValue; return MathUtility.Lerp(minValue, maxValue, random.NextDouble());
} }
/// <summary> /// <summary>