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)
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 ***********************************************************************/
18 #endif /* __cplusplus */
24 #include "support.h" /* bool type */
26 /* This is duplicated in shared.h to avoid extra includes: */
27 #define MAX_UINT32 0xFFFFFFFF
29 typedef uint32_t RANDOM_TYPE
;
34 bool is_init
; /* initially 0 for static storage */
37 #define fc_rand(_size) \
38 fc_rand_debug((_size), "fc_rand", __FC_LINE__, __FILE__)
40 RANDOM_TYPE
fc_rand_debug(RANDOM_TYPE size
, const char *called_as
,
41 int line
, const char *file
);
43 void fc_srand(RANDOM_TYPE seed
);
45 bool fc_rand_is_init(void);
46 RANDOM_STATE
fc_rand_state(void);
47 void fc_rand_set_state(RANDOM_STATE state
);
49 void test_random1(int n
);
53 #define fc_randomly(_seed, _size) \
54 fc_randomly_debug((_seed), (_size), "fc_randomly", __FC_LINE__, __FILE__)
56 RANDOM_TYPE
fc_randomly_debug(RANDOM_TYPE seed
, RANDOM_TYPE size
,
57 const char *called_as
,
58 int line
, const char *file
);
62 #endif /* __cplusplus */
64 #endif /* FC__RAND_H */