33 lines
758 B
C#
33 lines
758 B
C#
|
using System;
|
|||
|
|
|||
|
namespace SockChatKeepAlive {
|
|||
|
public static class RNG {
|
|||
|
private static readonly Random random = new();
|
|||
|
|
|||
|
public static int Next() {
|
|||
|
lock(random)
|
|||
|
return random.Next();
|
|||
|
}
|
|||
|
|
|||
|
public static int Next(int max) {
|
|||
|
lock(random)
|
|||
|
return random.Next(max);
|
|||
|
}
|
|||
|
|
|||
|
public static int Next(int min, int max) {
|
|||
|
lock(random)
|
|||
|
return random.Next(min, max);
|
|||
|
}
|
|||
|
|
|||
|
public static void NextBytes(byte[] buffer) {
|
|||
|
lock(random)
|
|||
|
random.NextBytes(buffer);
|
|||
|
}
|
|||
|
|
|||
|
public static double NextDouble() {
|
|||
|
lock(random)
|
|||
|
return random.NextDouble();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|