1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-16 10:53:11 +01:00
MLEM/MLEM.Extended/Extensions/RandomExtensions.cs

21 lines
630 B
C#
Raw Normal View History

2019-12-04 13:06:53 +01:00
using System;
2020-01-04 21:55:10 +01:00
using Microsoft.Xna.Framework;
2019-12-04 13:06:53 +01:00
using MonoGame.Extended;
namespace MLEM.Extended.Extensions {
public static class RandomExtensions {
public static int Range(this Random random, Range<int> range) {
return random.Next(range.Min, range.Max);
}
public static float Range(this Random random, Range<float> range) {
return random.NextSingle(range.Min, range.Max);
}
2020-01-04 21:57:10 +01:00
public static Vector2 NextVector2(this Random random, float min, float max) {
2020-01-04 21:55:10 +01:00
return new Vector2(random.NextSingle(min, max), random.NextSingle(min, max));
}
2019-12-04 13:06:53 +01:00
}
}