Interface IRandomService
This IService manages generation of random values. This service's functionality could be
overriden so that the seeds and/or random values are generated server-side.
Assembly: cs.temp.dll.dll
Syntax
public interface IRandomService : IService, IInjectable
Methods
GetRandomDouble()
Returns a random floating-point number greater than or equal to 0.0 and less than double.maxValue.
Declaration
Returns
GetRandomDouble(Double, Double)
Returns a random double that is within the specified range, inclusive of min and exclusive of max.
Declaration
double GetRandomDouble(double min, double max)
Parameters
Returns
Remarks
GetRandomDouble(Double, Double, Int32)
Returns a random double that is within the specified range, inclusive of min and
exclusive of max while providing an integer random seed.
Declaration
double GetRandomDouble(double min, double max, int seed)
Parameters
Returns
GetRandomDouble(Int32)
Returns a random floating-point number greater than or equal to 0.0 and less than double.maxValue
while providing an integer random seed..
Declaration
double GetRandomDouble(int seed)
Parameters
| Type |
Name |
Description |
| Int32 |
seed |
|
Returns
Remarks
GetRandomInt()
Returns a non-negative random integer.
Declaration
Returns
GetRandomInt(Int32)
Returns a non-negative random integer while providing an integer random seed.
Declaration
int GetRandomInt(int seed)
Parameters
| Type |
Name |
Description |
| Int32 |
seed |
|
Returns
GetRandomInt(Int32, Int32)
Returns a random integer that is within the specified range, inclusive of min and
exclusive of max.
Declaration
int GetRandomInt(int min, int max)
Parameters
Returns
GetRandomInt(Int32, Int32, Int32)
Returns a random integer that is within the specified range, inclusive of min and
exclusive of max while providing an integer random seed.
Declaration
int GetRandomInt(int min, int max, int seed)
Parameters
Returns
GetRandomSeed()
Returns a non-negative random integer for use as a seed.
Declaration
Returns
Remarks
GetRandomWeightedElement<TRandomWeighted>(TRandomWeighted[])
Returns a random element from the based on their weights.
Declaration
TRandomWeighted GetRandomWeightedElement<TRandomWeighted>(TRandomWeighted[] collection)
where TRandomWeighted : class, IRandomWeighted
Parameters
| Type |
Name |
Description |
| TRandomWeighted[] |
collection |
|
Returns
| Type |
Description |
| TRandomWeighted |
|
Type Parameters
| Name |
Description |
| TRandomWeighted |
|
GetRandomWeightedElement<TRandomWeighted>(TRandomWeighted[], Int32)
Returns a random element from the based on their weights while providing
an integer random seed..
Declaration
TRandomWeighted GetRandomWeightedElement<TRandomWeighted>(TRandomWeighted[] collection, int seed)
where TRandomWeighted : class, IRandomWeighted
Parameters
| Type |
Name |
Description |
| TRandomWeighted[] |
collection |
|
| Int32 |
seed |
|
Returns
| Type |
Description |
| TRandomWeighted |
|
Type Parameters
| Name |
Description |
| TRandomWeighted |
|
InitializeRandom()
Declaration
[Obsolete("Deprecated in version 1.4, use InitializeRandom(int) with int GetRandomSeed() to obtain a random seed.", true)]
void InitializeRandom()
InitializeRandom(Int32)
Initialize a new Random object used to generate random values while providing an integer random
seed.
Declaration
void InitializeRandom(int seed)
Parameters
| Type |
Name |
Description |
| Int32 |
seed |
|