using System;
using Microsoft.Xna.Framework;
using MonoGame.Extended;
namespace MLEM.Extended.Maths {
///
/// A set of extension methods for dealing with
///
public static class RandomExtensions {
///
/// Returns a random number in the given range.
///
/// The random to use for generation
/// The range in which numbers will be generated
/// A number in the given range
public static int Range(this Random random, Range range) {
return random.Next(range.Min, range.Max);
}
///
/// Returns a random number in the given range.
///
/// The random to use for generation
/// The range in which numbers will be generated
/// A number in the given range
public static float Range(this Random random, Range range) {
return random.NextSingle(range.Min, range.Max);
}
///
/// Returns a random vector whose x and y values are in the given range.
///
/// The random to use for generation
/// The minimum value for each coordinate
/// The maximum value for each coordinate
/// A random vector in the given range
public static Vector2 NextVector2(this Random random, float min, float max) {
return new Vector2(random.NextSingle(min, max), random.NextSingle(min, max));
}
}
}