server-master/srcs/_plugins/WingsEmu.Plugins.BasicImplementation/RandomFactory.cs
2026-02-10 18:21:30 +01:00

25 lines
No EOL
572 B
C#

using System;
using RandN;
using RandN.Compat;
using WingsEmu.Game;
namespace WingsEmu.Plugins.BasicImplementations;
public class RandomGenerator : IRandomGenerator
{
private static readonly Random Local = RandomShim.Create(SmallRng.Create());
public int RandomNumber(int min, int max)
{
if (min > max)
{
return RandomNumber(max, min);
}
return min == max ? max : Local.Next(min, max);
}
public int RandomNumber(int max) => RandomNumber(0, max);
public int RandomNumber() => RandomNumber(0, 100);
}