helapordo 1.4.20
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
25int hlpd_rand_docount(bool count);
26int hlpd_rand(void);
27unsigned long hlpd_hash(unsigned char *str);
28void gen_random_seed(char buffer[PATH_SEED_BUFSIZE+1]);
29bool check_seed(char buffer[PATH_SEED_BUFSIZE]);
30#endif // GAME_RNG_H
#define PATH_SEED_BUFSIZE
Definition game_core.h:1350
unsigned long hlpd_hash(unsigned char *str)
djb2 by Dan Bernstein.
Definition game_rng.c:55
bool check_seed(char buffer[PATH_SEED_BUFSIZE])
Checks the passed buffer as a seed.
Definition game_rng.c:93
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
int hlpd_rand_docount(bool count)
Wraps over rand() to update G_RNG_ADVANCEMENTS if passed flag is true.
Definition game_rng.c:29
int hlpd_rand(void)
Wraps over hlpd_rand_docount() to update G_RNG_ADVANCEMENTS.
Definition game_rng.c:42