FastRng/FastRng/IRandom.cs

21 lines
674 B
C#

using System;
using System.Numerics;
using System.Threading;
namespace FastRng;
/// <summary>
/// Interface for random number generators.
/// </summary>
public interface IRandom<TNum> : IDisposable where TNum : IFloatingPointIeee754<TNum>
{
/// <summary>
/// Returns a uniform distributed pseudo-random number from the interval (0,1].
/// This means, the result 0 is impossible, whereas 1 is possible.
/// </summary>
/// <remarks>
/// This method is thread-safe. You can consume numbers from the same generator
/// by using multiple threads at the same time.
/// </remarks>
public TNum GetUniform(CancellationToken cancel = default);
}