Show / Hide Table of Contents

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
System.Object
MaxRandom
Implements
Troschuetz.Random.IGenerator
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: GoRogue.Random
Assembly: GoRogue.dll
Syntax
public class MaxRandom : IGenerator

Properties

| Improve this Doc View Source

CanReset

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
| Improve this Doc View Source

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 Source

Next()

Returns System.Int32.MaxValue - 1.

Declaration
public int Next()
Returns
Type Description
System.Int32

System.Int32.MaxValue - 1.

| Improve this Doc View Source

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

maxValue - 1.

| Improve this Doc View Source

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

maxValue - 1.

| Improve this Doc View Source

NextBoolean()

Returns true.

Declaration
public bool NextBoolean()
Returns
Type Description
System.Boolean

true

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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) maxValue.

| Improve this Doc View Source

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) maxValue.

| Improve this Doc View Source

NextInclusiveMaxValue()

Returns System.Int32.MaxValue.

Declaration
public int NextInclusiveMaxValue()
Returns
Type Description
System.Int32

int.MaxValue

| Improve this Doc View Source

NextUInt()

Returns System.UInt32.MaxValue.

Declaration
public uint NextUInt()
Returns
Type Description
System.UInt32

System.UInt32.MaxValue - 1.

| Improve this Doc View Source

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

maxValue - 1

| Improve this Doc View Source

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

maxValue - 1

| Improve this Doc View Source

NextUIntExclusiveMaxValue()

Returns System.UInt32.MaxValue - 1.

Declaration
public uint NextUIntExclusiveMaxValue()
Returns
Type Description
System.UInt32

System.UInt32.MaxValue - 1.

| Improve this Doc View Source

NextUIntInclusiveMaxValue()

Returns System.UInt32.MaxValue.

Declaration
public uint NextUIntInclusiveMaxValue()
Returns
Type Description
System.UInt32

System.UInt32.MaxValue.

| Improve this Doc View Source

Reset()

Simply returns true, since this generator has no state.

Declaration
public bool Reset()
Returns
Type Description
System.Boolean

true

| Improve this Doc View Source

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

Implements

Troschuetz.Random.IGenerator

Extension Methods

Utility.Yield<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX