Class RandomWrapper
Inheritance
Implements
Namespace: GDX.Mathematics.Random
Syntax
public class RandomWrapper : IRandomProvider
Constructors
| Improve this Doc View SourceRandomWrapper()
Declaration
public RandomWrapper()
RandomWrapper(Int32)
Declaration
public RandomWrapper(int seed)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | seed |
Methods
| Improve this Doc View SourceNextBoolean(Single)
Returns a pseudorandom System.Boolean value based on chance, favoring false,
with a default 50% chance.
Declaration
public bool NextBoolean(float chance = 0.5F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | chance | The 0-1 System.Single percent chance of success. |
Returns
| Type | Description |
|---|---|
| System.Boolean | A pseudorandom System.Boolean. |
NextBytes(Byte[])
Fills a buffer with pseudorandom System.Byte.
Declaration
public void NextBytes(byte[] buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | buffer | The buffer to fill. |
Remarks
The buffer shouldn't be null.
NextDouble(Double, Double)
Returns the next pseudorandom System.Double between minValue and
less then maxValue.
Declaration
public double NextDouble(double minValue = 0, double maxValue = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | minValue | The lowest possible value (inclusive). |
| System.Double | maxValue | The highest possible value (exclusive). |
Returns
| Type | Description |
|---|---|
| System.Double | A pseudorandom System.Double. |
Remarks
Distribution of values falls within a linear scale.
minValue should not be greater then maxValue.
NextInteger(Int32, Int32)
Returns the next pseudorandom System.Int32 between minValue and
maxValue.
Declaration
public int NextInteger(int minValue = 0, int maxValue = 2147483647)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | minValue | The lowest possible value. |
| System.Int32 | maxValue | The highest possible value, including itself. |
Returns
| Type | Description |
|---|---|
| System.Int32 | A pseudorandom System.Int32. |
Remarks
Distribution of values falls within a linear scale.
minValue should not be greater then maxValue.
Never pass System.Int32.MaxValue to maxValue.
NextIntegerExclusive(Int32, Int32)
Returns the next pseudorandom System.Int32 between minValue and
maxValue, excluding maxValue itself.
Declaration
public int NextIntegerExclusive(int minValue = 0, int maxValue = 2147483647)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | minValue | The lowest possible value. |
| System.Int32 | maxValue | The highest possible value, excluding itself. |
Returns
| Type | Description |
|---|---|
| System.Int32 | A pseudorandom System.Int32. |
Remarks
Distribution of values falls within a linear scale.
minValue should not be greater then maxValue.
NextSingle(Single, Single)
Returns the next pseudorandom System.Single between minValue and
less then maxValue.
Declaration
public float NextSingle(float minValue = 0F, float maxValue = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | minValue | The lowest possible value (inclusive). |
| System.Single | maxValue | The highest possible value (exclusive). |
Returns
| Type | Description |
|---|---|
| System.Single | A pseudorandom System.Single. |
Remarks
Distribution of values falls within a linear scale.
minValue should not be greater then maxValue.
NextUnsignedInteger(UInt32, UInt32)
Returns the next pseudorandom System.UInt32 between minValue and
maxValue.
Declaration
public uint NextUnsignedInteger(uint minValue = 0U, uint maxValue = 4294967295U)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | minValue | The lowest possible value. |
| System.UInt32 | maxValue | The highest possible value, including itself. |
Returns
| Type | Description |
|---|---|
| System.UInt32 | A pseudorandom System.UInt32. |
Remarks
Distribution of values falls within a linear scale.
minValue should not be greater then maxValue.
Never pass System.UInt32.MaxValue to maxValue.
NextUnsignedIntegerExclusive(UInt32, UInt32)
Returns the next pseudorandom System.UInt32 between minValue and
maxValue, excluding maxValue itself.
Declaration
public uint NextUnsignedIntegerExclusive(uint minValue = 0U, uint maxValue = 4294967295U)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | minValue | The lowest possible value. |
| System.UInt32 | maxValue | The highest possible value, excluding itself. |
Returns
| Type | Description |
|---|---|
| System.UInt32 | A pseudorandom System.UInt32. |
Remarks
Distribution of values falls within a linear scale.
minValue should not be greater then maxValue.
Sample()
Returns the next pseudorandom System.Double value, between 0.0 and 1.0.
Declaration
public double Sample()
Returns
| Type | Description |
|---|---|
| System.Double | A pseudorandom System.Double floating point value. |