using System; public static class MathHelper { private readonly static Random s_random = new Random(); public static double RandomDouble(double min, double max) { return (s_random.NextDouble() * (max - min)) + min; } public static float RandomFloat(float min, float max) { return (float)RandomDouble(min, max); } public static int Dice(int n) { return (int)Math.Floor(RandomDouble(0, n)); } public static bool CoinFlip() { return Dice(2) == 0; } }