using System; namespace MBS.Framework { public static class MathExtensions { /// /// Multiplies a floating point value x by the number 2 raised to the exp power. /// /// The ldexp. /// The x coordinate. /// Exp. public static float ldexp(float x, int exp) { return (float)(x * Math.Pow(2, exp)); } /// /// Multiplies a floating point value x by the number 2 raised to the exp power. /// /// The ldexp. /// The x coordinate. /// Exp. public static double ldexp(double x, int exp) { 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); } } }