Class Environment.Random
Class used to generate random numbers. This class should always be used when random numbers are needed. There is a seed property that the user can control in the Experior GUI. The seed value is used by this class. The seed property in the GUI will not (automatically) affect other random number generators (if used).
Inheritance
Inherited Members
Namespace: Experior.Core
Assembly: Experior.Core.dll
Syntax
public class Random
Properties
Generator
The random generator used by the class.
Declaration
public static StandardGenerator Generator { get; }
Property Value
Type | Description |
---|---|
StandardGenerator |
Seed
The seed used to generate the pseudo random numbers.
Declaration
public static int Seed { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Next()
Returns a nonnegative random number.
Declaration
public static int Next()
Returns
Type | Description |
---|---|
System.Int32 | A 32-bit signed integer greater than or equal to zero and less than System.Int32.MaxValue. |
Next(Int32)
Returns a nonnegative random number less than the specified maximum.
Declaration
public static int Next(int max)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | max | The exclusive upper bound of the random number to be generated.
|
Returns
Type | Description |
---|---|
System.Int32 | A 32-bit signed integer greater than or equal to 0, and less than |
Next(Int32, Int32)
Returns a random number within a specified range.
Declaration
public static int Next(int min, int max)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | min | The inclusive lower bound of the random number to be generated. |
System.Int32 | max | The exclusive upper bound of the random number to be generated.
|
Returns
Type | Description |
---|---|
System.Int32 | A 32-bit signed integer greater than or equal to |
NextDouble()
Returns a nonnegative floating point random number less than 1.0.
Declaration
public static double NextDouble()
Returns
Type | Description |
---|---|
System.Double | A double-precision floating point number greater than or equal to 0.0, and less than 1.0; that is, the range of return values includes 0.0 but not 1.0. |
NextDouble(Double)
Returns a nonnegative floating point random number less than the specified maximum.
Declaration
public static double NextDouble(double max)
Parameters
Type | Name | Description |
---|---|---|
System.Double | max | The exclusive upper bound of the random number to be generated.
|
Returns
Type | Description |
---|---|
System.Double | A double-precision floating point number greater than or equal to zero, and less than |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
NextDouble(Double, Double)
Returns a floating point random number within the specified range.
Declaration
public static double NextDouble(double min, double max)
Parameters
Type | Name | Description |
---|---|---|
System.Double | min | The inclusive lower bound of the random number to be generated.
The range between |
System.Double | max | The exclusive upper bound of the random number to be generated.
|
Returns
Type | Description |
---|---|
System.Double | A double-precision floating point number greater than or equal to |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | |
System.ArgumentException |
Reset()
Resets the StandardGenerator, so that it produces the same pseudo-random number sequence again.
Declaration
public static void Reset()