using System;
using System.Collections.Generic;
public static class MathUtil
{
private static volatile int _seed;
public static bool RandomBooleanWithProbability(double probability)
{
_seed += DateTime.Now.Millisecond;
var random = new Random(_seed);
return random.NextDouble() < probability;
}
public static double RandomDoubleFromRange(double from, double to)
{
_seed += DateTime.Now.Millisecond;
var random = new Random(_seed);
var diff = Math.Abs(from - to);
return random.NextDouble() * diff + from;
}
public static int RandomIntFromRange(int from, int to)
{
_seed += DateTime.Now.Millisecond;
var random = new Random(_seed);
return random.Next(from, to + 1);
}
}