mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 23:26:40 -08:00
Improve Random interface
This commit is contained in:
@@ -6,47 +6,17 @@ namespace Games.Common.Randomness;
|
||||
public interface IRandom
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a random <see cref="float" /> such that 0 <= n < 1.
|
||||
/// Gets a random <see cref="float" /> such that 0 <= n < 1.
|
||||
/// </summary>
|
||||
/// <returns>The random number.</returns>
|
||||
float NextFloat();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a random <see cref="float" /> such that 0 <= n < exclusiveMaximum.
|
||||
/// </summary>
|
||||
/// <returns>The random number.</returns>
|
||||
float NextFloat(float exclusiveMaximum);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a random <see cref="float" /> such that inclusiveMinimum <= n < exclusiveMaximum.
|
||||
/// </summary>
|
||||
/// <returns>The random number.</returns>
|
||||
float NextFloat(float inclusiveMinimum, float exclusiveMaximum);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a random <see cref="int" /> such that 0 <= n < exclusiveMaximum.
|
||||
/// </summary>
|
||||
/// <returns>The random number.</returns>
|
||||
int Next(int exclusiveMaximum);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a random <see cref="int" /> such that inclusiveMinimum <= n < exclusiveMaximum.
|
||||
/// </summary>
|
||||
/// <returns>The random number.</returns>
|
||||
int Next(int inclusiveMinimum, int exclusiveMaximum);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the previous random number as a <see cref="float" />.
|
||||
/// Gets the <see cref="float" /> returned by the previous call to <see cref="NextFloat" />.
|
||||
/// </summary>
|
||||
/// <returns>The previous random number.</returns>
|
||||
float PreviousFloat();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the previous random number as an <see cref="int" />.
|
||||
/// </summary>
|
||||
/// <returns>The previous random number.</returns>
|
||||
int Previous();
|
||||
|
||||
/// <summary>
|
||||
/// Reseeds the random number generator.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user