Melee Modding Library
2.0.0
A C library for modding Super Smash Bros Melee
|
Random number generation. More...
Go to the source code of this file.
Functions | |
float | rand () |
Generate random number in [0,1]. More... | |
float | uniform (float a, float b) |
Sample uniformly from [a, b] . More... | |
unsigned | sample (const float *probs, size_t size) |
Return index of array according to given probabilities. More... | |
bool | chance (FunctionArg prob) |
Single 'coin flip' with given probability. More... | |
Random number generation.
float rand | ( | ) |
Generate random number in [0,1].
float uniform | ( | float | a, |
float | b | ||
) |
Sample uniformly from [a, b]
.
[a, b]
unsigned sample | ( | const float * | probs, |
size_t | size | ||
) |
Return index of array according to given probabilities.
probs | - array of probabilities, must sum to 1 |
size | - size of probability array |
bool chance | ( | FunctionArg | prob | ) |
Single 'coin flip' with given probability.
prob | - floating-point value in [0,1] |
prob