diff --git a/MBS.Framework/MathExtensions.cs b/MBS.Framework/MathExtensions.cs index e511af5..1a6a5bc 100644 --- a/MBS.Framework/MathExtensions.cs +++ b/MBS.Framework/MathExtensions.cs @@ -23,5 +23,18 @@ namespace MBS.Framework { return (x * Math.Pow(2, exp)); } + + /// + /// Returns a random between + /// and . + /// + /// The random number. + /// The instance of being extended. + /// The inclusive minimum bound of the resulting random value. + /// The exclusive maximum bound of the resulting random value. + public static long NextLong (this Random random, long minValue = 0, long maxValue = long.MaxValue) + { + return (long)((random.NextDouble() * (maxValue - minValue)) + minValue); + } } }