2018-12-29 16:05:19 -08:00
|
|
|
# Random Number Generation
|
|
|
|
|
2019-02-02 18:06:35 -08:00
|
|
|
All of these functions may have `[identifier]` between the function name and
|
|
|
|
the argument list to specify a named RNG table to use. This special syntax
|
|
|
|
applies only to these functions.
|
2018-12-29 16:05:19 -08:00
|
|
|
|
|
|
|
```
|
|
|
|
double FRandom(double min, double max);
|
|
|
|
double FRandomPick(double...);
|
|
|
|
int Random(int min = 0, int max = 255);
|
|
|
|
int Random2(uint mask = uint.Max);
|
|
|
|
int RandomPick(int...);
|
|
|
|
void SetRandomSeed(uint num);
|
|
|
|
```
|
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
### `FRandom`
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
Returns a random float between `min` and `max`.
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
### `FRandomPick`
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
Same as `RandomPick`, but with floats.
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
### `Random`
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
Returns a random integer between `min` and `max`.
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
### `Random2`
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
Returns a random integer value between `-mask` and `mask`. `mask` is used as a
|
|
|
|
bit mask, so it is recommended to use a value of one less than a power of two
|
|
|
|
(i.e. 3, 7, 15, 31, 63, 127, 255...)
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
### `RandomPick`
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
Returns one of the provided parameters randomly.
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
### `SetRandomSeed`
|
2018-12-29 16:05:19 -08:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
Sets the seed of the RNG table to `num`.
|
2018-12-29 16:05:19 -08:00
|
|
|
|
|
|
|
<!-- EOF -->
|