helapordo
1.4.23
Toggle main menu visibility
Loading...
Searching...
No Matches
game_rng.h
Go to the documentation of this file.
1
// jgabaut @ github.com/jgabaut
2
// SPDX-License-Identifier: GPL-3.0-only
3
/*
4
Copyright (C) 2022-2026 jgabaut
5
6
This program is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, version 3 of the License.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program. If not, see <https://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef GAME_RNG_H
20
#define GAME_RNG_H
21
#include <stdbool.h>
22
#include "
game_core.h
"
23
#include "
game_log.h
"
24
25
int
hlpd_rand_docount
(
bool
count);
26
int
hlpd_rand
(
void
);
27
unsigned
long
hlpd_hash
(
unsigned
char
*str);
28
void
gen_random_seed
(
char
buffer[
PATH_SEED_BUFSIZE
+1]);
29
bool
check_seed
(
char
buffer[
PATH_SEED_BUFSIZE
]);
30
#endif
// GAME_RNG_H
game_core.h
PATH_SEED_BUFSIZE
#define PATH_SEED_BUFSIZE
Definition
game_core.h:1351
game_log.h
hlpd_hash
unsigned long hlpd_hash(unsigned char *str)
djb2 by Dan Bernstein.
Definition
game_rng.c:55
check_seed
bool check_seed(char buffer[PATH_SEED_BUFSIZE])
Checks the passed buffer as a seed.
Definition
game_rng.c:93
gen_random_seed
void gen_random_seed(char buffer[PATH_SEED_BUFSIZE+1])
Sets the passed buffer up to be a random seed.
Definition
game_rng.c:73
hlpd_rand_docount
int hlpd_rand_docount(bool count)
Wraps over rand() to update G_RNG_ADVANCEMENTS if passed flag is true.
Definition
game_rng.c:29
hlpd_rand
int hlpd_rand(void)
Wraps over hlpd_rand_docount() to update G_RNG_ADVANCEMENTS.
Definition
game_rng.c:42
src
core
game_rng.h
Generated by
1.18.0