25 lines
485 B
C#
25 lines
485 B
C#
using System;
|
|
|
|
namespace NightclubArcadia.Skills
|
|
{
|
|
public sealed class SeededRollSource : IRollSource
|
|
{
|
|
readonly Random _random;
|
|
|
|
public SeededRollSource(int seed)
|
|
{
|
|
_random = new Random(seed);
|
|
}
|
|
|
|
public int Roll(int sides)
|
|
{
|
|
if (sides < 1)
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(sides));
|
|
}
|
|
|
|
return _random.Next(1, sides + 1);
|
|
}
|
|
}
|
|
}
|