Header And Logo

PostgreSQL
| The world's most advanced open source database.

geqo_random.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * geqo_random.h
00004  *    random number generator
00005  *
00006  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00007  * Portions Copyright (c) 1994, Regents of the University of California
00008  *
00009  * src/include/optimizer/geqo_random.h
00010  *
00011  *-------------------------------------------------------------------------
00012  */
00013 
00014 /* contributed by:
00015    =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
00016    *  Martin Utesch              * Institute of Automatic Control      *
00017    =                             = University of Mining and Technology =
00018    *  [email protected]  * Freiberg, Germany                   *
00019    =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
00020  */
00021 
00022 /* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */
00023 
00024 #ifndef GEQO_RANDOM_H
00025 #define GEQO_RANDOM_H
00026 
00027 #include <math.h>
00028 
00029 #include "optimizer/geqo.h"
00030 
00031 
00032 extern void geqo_set_seed(PlannerInfo *root, double seed);
00033 
00034 /* geqo_rand returns a random float value between 0 and 1 inclusive */
00035 extern double geqo_rand(PlannerInfo *root);
00036 
00037 /* geqo_randint returns integer value between lower and upper inclusive */
00038 #define geqo_randint(root, upper, lower) \
00039     ( (int) floor( geqo_rand(root)*(((upper)-(lower))+0.999999) ) + (lower) )
00040 
00041 #endif   /* GEQO_RANDOM_H */