using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MrAG { public class Random { private static System.Security.Cryptography.RandomNumberGenerator rnd = System.Security.Cryptography.RandomNumberGenerator.Create(); public static int Next(){ byte[] tbl = new byte[1]; rnd.GetNonZeroBytes(tbl); return tbl[0]; } public static int Next(int min, int max){ byte[] tbl = new byte[1]; rnd.GetNonZeroBytes(tbl); return (int)((double)tbl[0] / 255.0 * (max - min)) + min; } public static double NextDouble(){ byte[] tbl = new byte[1]; rnd.GetNonZeroBytes(tbl); return (double)tbl[0] / 255.0 * 1.0; } public static double NextDouble(int min, int max){ byte[] tbl = new byte[1]; rnd.GetNonZeroBytes(tbl); return ((double)tbl[0] / 255.0 * (max - min)) + min; } } }