Freeciv-3.1
Loading...
Searching...
No Matches
rand.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__RAND_H
14#define FC__RAND_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20#include <stdint.h>
21
22/* Utility */
23#include "log.h"
24#include "support.h" /* bool type */
25
26typedef uint32_t RANDOM_TYPE;
27
28typedef struct {
30 int j, k, x;
31 bool is_init; /* initially FALSE for static storage */
33
34#define fc_rand(_size) \
35 fc_rand_debug((_size), "fc_rand", __FC_LINE__, __FILE__)
36
37RANDOM_TYPE fc_rand_debug(RANDOM_TYPE size, const char *called_as,
38 int line, const char *file);
39
40void fc_srand(RANDOM_TYPE seed);
41
42void fc_rand_uninit(void);
43bool fc_rand_is_init(void);
46
47void test_random1(int n);
48
49/*===*/
50
51#define fc_randomly(_seed, _size) \
52 fc_randomly_debug((_seed), (_size), "fc_randomly", __FC_LINE__, __FILE__)
53
55 const char *called_as,
56 int line, const char *file);
57
58#ifdef __cplusplus
59}
60#endif /* __cplusplus */
61
62#endif /* FC__RAND_H */
#define n
Definition astring.c:77
bool fc_rand_is_init(void)
Definition rand.c:167
RANDOM_STATE fc_rand_state(void)
Definition rand.c:175
RANDOM_TYPE fc_rand_debug(RANDOM_TYPE size, const char *called_as, int line, const char *file)
Definition rand.c:81
void fc_srand(RANDOM_TYPE seed)
Definition rand.c:128
uint32_t RANDOM_TYPE
Definition rand.h:26
RANDOM_TYPE fc_randomly_debug(RANDOM_TYPE seed, RANDOM_TYPE size, const char *called_as, int line, const char *file)
Definition rand.c:259
void test_random1(int n)
Definition rand.c:220
void fc_rand_uninit(void)
Definition rand.c:159
void fc_rand_set_state(RANDOM_STATE state)
Definition rand.c:196
size_t size
Definition specvec.h:72
bool is_init
Definition rand.h:31
int j
Definition rand.h:30