(RANDOM, SRANDOM): New, to allow overriding the PRNG on the compiler
command line for reproducible automated tests. This is expected to be a temporary solution until we get more capable system configuration. Callers of random(), srandom() changed. From Marc Olzheim.
This commit is contained in:
parent
43c511e8ad
commit
0608bff5b4
1 changed files with 8 additions and 2 deletions
|
@ -121,7 +121,13 @@ static int DISTINCT_ISLANDS = 1;
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#define max(a,b) (a>b?a:b)
|
#define max(a,b) (a>b?a:b)
|
||||||
#endif
|
#endif
|
||||||
#define rnd(x) (random() % (x))
|
#ifndef SRANDOM
|
||||||
|
#define SRANDOM srandom
|
||||||
|
#endif
|
||||||
|
#ifndef RANDOM
|
||||||
|
#define RANDOM random
|
||||||
|
#endif
|
||||||
|
#define rnd(x) (RANDOM() % (x))
|
||||||
|
|
||||||
int secs; /* number of sectors grown */
|
int secs; /* number of sectors grown */
|
||||||
int ctot; /* total number of continents and islands grown */
|
int ctot; /* total number of continents and islands grown */
|
||||||
|
@ -221,7 +227,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
srandom(rnd_seed);
|
SRANDOM(rnd_seed);
|
||||||
if (config_file == NULL) {
|
if (config_file == NULL) {
|
||||||
sprintf(tbuf, "%s/econfig", datadir);
|
sprintf(tbuf, "%s/econfig", datadir);
|
||||||
config_file = tbuf;
|
config_file = tbuf;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue