/* Made by Lonami Exo
* (C) LonamiWebs */
/// <summary>
/// Pure random numbers generator
/// </summary>
public static class PureRandom {
/// <summary>
/// Gets a pure random int
/// </summary>
/// <param name="min">Minimum value</param>
/// <param name="max">Maximum value</param>
/// <returns>Pure random int</returns>
public static int GetPureInt(int min, int max) {
return new Random(GetUniqueSeed()).Next(min, max);
}
/// <summary>
/// Gets a pure random double
/// </summary>
/// <param name="min">Minimum value</param>
/// <param name="max">Maximum value</param>
/// <returns>Pure random double</returns>
public static double GetPureDouble(int min, int max) {
return new Random(GetUniqueSeed()).NextDouble(min, max);
}
static int GetUniqueSeed() {
int seed = 0;
foreach (char c in Guid.NewGuid().ToString())
seed += c.GetHashCode();
return seed;
}
}
Yes, C# lied to you. Random numbers are not always random, but hey, this class solves that!
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.