-
Notifications
You must be signed in to change notification settings - Fork 0
/
StaticRandom.cs
36 lines (30 loc) · 919 Bytes
/
StaticRandom.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
namespace FlightComputer
{
// This is primarily used to generate random window IDs across the setting manager without
// having to worry about ID clashes, as is a common problem with the C# Random class.
public static class StaticRandom
{
private static readonly Random Randomizer = new Random();
public static int Next()
{
return Randomizer.Next();
}
public static int Next(int upperBound)
{
return Randomizer.Next(upperBound);
}
public static int Next(int upperBound, int lowerBound)
{
return Randomizer.Next(upperBound, lowerBound);
}
public static void NextBytes(Byte[] bytes)
{
Randomizer.NextBytes(bytes);
}
public static double NextDouble()
{
return Randomizer.NextDouble();
}
}
}