PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
geqo_random.c File Reference
#include "postgres.h"
#include "optimizer/geqo_random.h"
Include dependency graph for geqo_random.c:

Go to the source code of this file.


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

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