LCOV - code coverage report
Current view: top level - src/backend/optimizer/geqo - geqo_random.c (source / functions) Hit Total Coverage
Test: PostgreSQL 13devel Lines: 8 8 100.0 %
Date: 2019-11-21 14:06:36 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*------------------------------------------------------------------------
       2             :  *
       3             :  * geqo_random.c
       4             :  *     random number generator
       5             :  *
       6             :  * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
       7             :  * Portions Copyright (c) 1994, Regents of the University of California
       8             :  *
       9             :  * src/backend/optimizer/geqo/geqo_random.c
      10             :  *
      11             :  *-------------------------------------------------------------------------
      12             :  */
      13             : 
      14             : #include "postgres.h"
      15             : 
      16             : #include "optimizer/geqo_random.h"
      17             : 
      18             : 
      19             : void
      20           4 : geqo_set_seed(PlannerInfo *root, double seed)
      21             : {
      22           4 :     GeqoPrivateData *private = (GeqoPrivateData *) root->join_search_private;
      23             : 
      24             :     /*
      25             :      * XXX. This seeding algorithm could certainly be improved - but it is not
      26             :      * critical to do so.
      27             :      */
      28           4 :     memset(private->random_state, 0, sizeof(private->random_state));
      29           4 :     memcpy(private->random_state,
      30             :            &seed,
      31             :            Min(sizeof(private->random_state), sizeof(seed)));
      32           4 : }
      33             : 
      34             : double
      35        2160 : geqo_rand(PlannerInfo *root)
      36             : {
      37        2160 :     GeqoPrivateData *private = (GeqoPrivateData *) root->join_search_private;
      38             : 
      39        2160 :     return pg_erand48(private->random_state);
      40             : }

Generated by: LCOV version 1.13