ex-col-03-santa/SantaClausInc/Core/RandomProvider.cs
github-classroom[bot] 3768d366ff
Initial commit
2024-12-11 15:23:18 +00:00

19 lines
540 B
C#

namespace SantaClausInc.Core;
/// <summary>
/// Provides a <see cref="Random" /> instance.
/// </summary>
public static class RandomProvider
{
private static Random? _overriddenInstance;
/// <summary>
/// Gets a default or, if overridden, a custom random instance.
/// Allows to override the default random instance with a specific, seeded one.
/// </summary>
public static Random Random
{
get => _overriddenInstance ?? Random.Shared;
set => _overriddenInstance = value;
}
}