|
helapordo 1.4.20
|
#include "game_rng.h"
Functions | |
| int | hlpd_rand_docount (bool count) |
| Wraps over rand() to update G_RNG_ADVANCEMENTS if passed flag is true. | |
| int | hlpd_rand (void) |
| Wraps over hlpd_rand_docount() to update G_RNG_ADVANCEMENTS. | |
| unsigned long | hlpd_hash (unsigned char *str) |
| djb2 by Dan Bernstein. | |
| void | gen_random_seed (char buffer[PATH_SEED_BUFSIZE+1]) |
| Sets the passed buffer up to be a random seed. | |
| bool | check_seed (char buffer[PATH_SEED_BUFSIZE]) |
| Checks the passed buffer as a seed. | |
Variables | |
| int64_t | G_RNG_ADVANCEMENTS = 0 |
| Global variable used to count advancements of the rng. | |
| bool check_seed | ( | char | buffer[PATH_SEED_BUFSIZE] | ) |
Checks the passed buffer as a seed.
Only chars >= 0, <= Z; not including the symbols between digits and letters. Notably, the passed buffer is checked by applying toupper() to each char.
| buffer | The buffer to check. |
| void gen_random_seed | ( | char | buffer[PATH_SEED_BUFSIZE+1] | ) |
Sets the passed buffer up to be a random seed.
Only chars >= 0, <= Z; not including the symbols between digits and letters.
| buffer | The buffer to set. |
| unsigned long hlpd_hash | ( | unsigned char * | str | ) |
djb2 by Dan Bernstein.
See: http://www.cse.yorku.ca/~oz/hash.html https://stackoverflow.com/questions/7666509/hash-function-for-string
| str | The string to hash. |
| int hlpd_rand | ( | void | ) |
Wraps over hlpd_rand_docount() to update G_RNG_ADVANCEMENTS.
| int hlpd_rand_docount | ( | bool | count | ) |
Wraps over rand() to update G_RNG_ADVANCEMENTS if passed flag is true.
| count | When true, advance G_RNG_ADVANCEMENTS. |
| int64_t G_RNG_ADVANCEMENTS = 0 |
Global variable used to count advancements of the rng.