Class RandomNumberGenerator
Simple wrapper around a random number generator that can be reset easily.
Inheritance
object
RandomNumberGenerator
Namespace: AS2
Assembly: .dll
Syntax
public class RandomNumberGenerator
Constructors
| Edit this page View SourceRandomNumberGenerator(int)
Declaration
public RandomNumberGenerator(int seed)
Parameters
Type | Name | Description |
---|---|---|
int | seed |
Fields
| Edit this page View Source_random
Declaration
private Random _random
Field Value
Type | Description |
---|---|
Random |
_seed
Declaration
private readonly int _seed
Field Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceRange(int, int)
Computes a random integer between min
and max
.
Declaration
public int Range(int min, int max)
Parameters
Type | Name | Description |
---|---|---|
int | min | The minimal value to return. |
int | max | The maximal value to return. |
Returns
Type | Description |
---|---|
int | A random integer between |
Range(float, float)
Computes a random float between min
and max
.
Declaration
public float Range(float min, float max)
Parameters
Type | Name | Description |
---|---|---|
float | min | The minimal value to return. |
float | max | The maximal value to return. |
Returns
Type | Description |
---|---|
float | A random float between |
Reset()
Resets the random number generator's state using the seed it was constructed with.
Declaration
public void Reset()