Show / Hide Table of Contents

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
System.Object
Environment.Random
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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. max must be greater than or equal to 0.

Returns
Type Description
System.Int32

A 32-bit signed integer greater than or equal to 0, and less than max; that is, the range of return values includes 0 but not max.

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. max must be greater than or equal to min.

Returns
Type Description
System.Int32

A 32-bit signed integer greater than or equal to min, and less than max; that is, the range of return values includes min but not max. If min equals max, min is returned.

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. max must be greater than or equal to zero.

Returns
Type Description
System.Double

A double-precision floating point number greater than or equal to zero, and less than max; that is, the range of return values includes zero but not max.

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 min and max must be less than or equal to System.Double.MaxValue

System.Double max

The exclusive upper bound of the random number to be generated. max must be greater than or equal to min. The range between min and max must be less than or equal to System.Double.MaxValue.

Returns
Type Description
System.Double

A double-precision floating point number greater than or equal to min, and less than max; that is, the range of return values includes min but not max. If min equals max, min is returned.

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()
Back to top Generated by DocFX