Fix a few errors in comments. Patch by Fujii Masao, plus the one in
[PostgreSQL.git] / src / include / optimizer / geqo_random.h
blobfab072828f7d39d67601db76d5f7abdf9c8e5322
1 /*-------------------------------------------------------------------------
3 * geqo_random.h
4 * random number generator
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * $PostgreSQL$
11 *-------------------------------------------------------------------------
14 /* contributed by:
15 =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
16 * Martin Utesch * Institute of Automatic Control *
17 = = University of Mining and Technology =
18 * utesch@aut.tu-freiberg.de * Freiberg, Germany *
19 =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
22 /* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */
24 #ifndef GEQO_RANDOM_H
25 #define GEQO_RANDOM_H
27 #include <math.h>
29 /* geqo_rand returns a random float value between 0 and 1 inclusive */
31 #define geqo_rand() ((double) random() / (double) MAX_RANDOM_VALUE)
33 /* geqo_randint returns integer value between lower and upper inclusive */
35 #define geqo_randint(upper,lower) \
36 ( (int) floor( geqo_rand()*(((upper)-(lower))+0.999999) ) + (lower) )
38 #endif /* GEQO_RANDOM_H */