PostgreSQL Source Code  git master
geqo_random.h File Reference
#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.

Functions

void geqo_set_seed (PlannerInfo *root, double seed)
 
double geqo_rand (PlannerInfo *root)
 
int geqo_randint (PlannerInfo *root, int upper, int lower)
 

Function Documentation

◆ geqo_rand()

double geqo_rand ( PlannerInfo root)

Definition at line 28 of file geqo_random.c.

29 {
30  GeqoPrivateData *private = (GeqoPrivateData *) root->join_search_private;
31 
32  return pg_prng_double(&private->random_state);
33 }
double pg_prng_double(pg_prng_state *state)
Definition: pg_prng.c:268
tree ctl root
Definition: radixtree.h:1880

References pg_prng_double(), and root.

Referenced by linear_rand().

◆ geqo_randint()

int geqo_randint ( PlannerInfo root,
int  upper,
int  lower 
)

Definition at line 36 of file geqo_random.c.

37 {
38  GeqoPrivateData *private = (GeqoPrivateData *) root->join_search_private;
39 
40  /*
41  * In current usage, "lower" is never negative so we can just use
42  * pg_prng_uint64_range directly.
43  */
44  return (int) pg_prng_uint64_range(&private->random_state, lower, upper);
45 }
Datum lower(PG_FUNCTION_ARGS)
Definition: oracle_compat.c:49
Datum upper(PG_FUNCTION_ARGS)
Definition: oracle_compat.c:80
uint64 pg_prng_uint64_range(pg_prng_state *state, uint64 rmin, uint64 rmax)
Definition: pg_prng.c:144

References lower(), pg_prng_uint64_range(), root, and upper().

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

◆ geqo_set_seed()

void geqo_set_seed ( PlannerInfo root,
double  seed 
)

Definition at line 20 of file geqo_random.c.

21 {
22  GeqoPrivateData *private = (GeqoPrivateData *) root->join_search_private;
23 
24  pg_prng_fseed(&private->random_state, seed);
25 }
void pg_prng_fseed(pg_prng_state *state, double fseed)
Definition: pg_prng.c:102

References pg_prng_fseed(), and root.

Referenced by geqo().