PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
geqo_random.h File Reference
#include <math.h>
#include "optimizer/geqo.h"
Include dependency graph for geqo_random.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define geqo_randint(root, upper, lower)   ( (int) floor( geqo_rand(root)*(((upper)-(lower))+0.999999) ) + (lower) )


void geqo_set_seed (PlannerInfo *root, double seed)
double geqo_rand (PlannerInfo *root)

Macro Definition Documentation

#define geqo_randint (   root,
)    ( (int) floor( geqo_rand(root)*(((upper)-(lower))+0.999999) ) + (lower) )

Definition at line 38 of file geqo_random.h.

Referenced by edge_failure(), gimme_gene(), gimme_tour(), and init_tour().

Function Documentation

double geqo_rand ( PlannerInfo root)

Definition at line 35 of file geqo_random.c.

References PlannerInfo::join_search_private, and pg_erand48().

Referenced by linear_rand().

36 {
39  return pg_erand48(private->random_state);
40 }
void * join_search_private
Definition: relation.h:319
double pg_erand48(unsigned short xseed[3])
Definition: erand48.c:79
void geqo_set_seed ( PlannerInfo root,
double  seed 

Definition at line 20 of file geqo_random.c.

References PlannerInfo::join_search_private, and Min.

Referenced by geqo().

21 {
24  /*
25  * XXX. This seeding algorithm could certainly be improved - but it is not
26  * critical to do so.
27  */
28  memset(private->random_state, 0, sizeof(private->random_state));
29  memcpy(private->random_state,
30  &seed,
31  Min(sizeof(private->random_state), sizeof(seed)));
32 }
void * join_search_private
Definition: relation.h:319
#define Min(x, y)
Definition: c.h:812