Class MaxRandom
A "random" number generator that always returns the maxValue parameter given. Again this may be useful in testing, testing the upper range or repeatedly returning a value. Also used in DiceExpression instances for certain max roll functions.
Inheritance
Implements
Inherited Members
Namespace: GoRogue.Random
Assembly: GoRogue.dll
Syntax
public class MaxRandom : IGenerator
Properties
| Improve this Doc View SourceCanReset
Whether or not the RNG is capable of resetting, such that it will return the same series of values again.
Declaration
public bool CanReset { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Seed
Since this RNG returns the maximum possible value, this field will always return 0.
Declaration
public uint Seed { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Methods
| Improve this Doc View SourceNext()
Returns System.Int32.MaxValue - 1.
Declaration
public int Next()
Returns
Type | Description |
---|---|
System.Int32 | System.Int32.MaxValue - 1. |
Next(Int32)
Returns maxValue
- 1.
Declaration
public int Next(int maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxValue | Maximum bound of the returned number, exclusive. |
Returns
Type | Description |
---|---|
System.Int32 |
|
Next(Int32, Int32)
Returns maxValue
- 1.
Declaration
public int Next(int minValue, int maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | minValue | The minimum value that can be returned (unused since this generator always returns the maximum). |
System.Int32 | maxValue | The maximum value of the returned number, exclusive. |
Returns
Type | Description |
---|---|
System.Int32 |
|
NextBoolean()
Returns true.
Declaration
public bool NextBoolean()
Returns
Type | Description |
---|---|
System.Boolean | true |
NextBytes(Byte[])
Fills the given buffer with bytes of value System.Byte.MaxValue.
Declaration
public void NextBytes(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | Buffer to fill. |
NextDouble()
Returns a number very close to (but still less than) 1.0.
Declaration
public double NextDouble()
Returns
Type | Description |
---|---|
System.Double | A number very close to (but still less than) 1.0. |
Remarks
Value returned is 0.99999999999999978.
NextDouble(Double)
Returns a double very close to (but still less than) maxValue
.
Declaration
public double NextDouble(double maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.Double | maxValue | Maximum value for the returned value (exclusive). |
Returns
Type | Description |
---|---|
System.Double | A double very close to (but still less than) |
NextDouble(Double, Double)
Returns a double very close to (but still less than) maxValue
.
Declaration
public double NextDouble(double minValue, double maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.Double | minValue | Minimum value for the returned value. Unused since this generator always returns the maximum value. |
System.Double | maxValue | Maximum value for the returned value (exclusive). |
Returns
Type | Description |
---|---|
System.Double | A double very close to (but still less than) |
NextInclusiveMaxValue()
Returns System.Int32.MaxValue.
Declaration
public int NextInclusiveMaxValue()
Returns
Type | Description |
---|---|
System.Int32 | int.MaxValue |
NextUInt()
Returns System.UInt32.MaxValue.
Declaration
public uint NextUInt()
Returns
Type | Description |
---|---|
System.UInt32 | System.UInt32.MaxValue - 1. |
NextUInt(UInt32)
Returns maxValue
- 1.
Declaration
public uint NextUInt(uint maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | maxValue | The maximum bound for the returned number, exclusive. |
Returns
Type | Description |
---|---|
System.UInt32 |
|
NextUInt(UInt32, UInt32)
Returns maxValue
- 1.
Declaration
public uint NextUInt(uint minValue, uint maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | minValue | The minimum value that can be returned (unused since this generator always returns the maximum). |
System.UInt32 | maxValue | The maximum bound for the returned number, exclusive. |
Returns
Type | Description |
---|---|
System.UInt32 |
|
NextUIntExclusiveMaxValue()
Returns System.UInt32.MaxValue - 1.
Declaration
public uint NextUIntExclusiveMaxValue()
Returns
Type | Description |
---|---|
System.UInt32 | System.UInt32.MaxValue - 1. |
NextUIntInclusiveMaxValue()
Returns System.UInt32.MaxValue.
Declaration
public uint NextUIntInclusiveMaxValue()
Returns
Type | Description |
---|---|
System.UInt32 | System.UInt32.MaxValue. |
Reset()
Simply returns true, since this generator has no state.
Declaration
public bool Reset()
Returns
Type | Description |
---|---|
System.Boolean | true |
Reset(UInt32)
Simply returns true, since this generator has no state.
Declaration
public bool Reset(uint seed)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | seed | Unused, since this generator has no seed. |
Returns
Type | Description |
---|---|
System.Boolean | true |