LCOV - code coverage report
Current view: top level - src/backend/optimizer/geqo - geqo_random.c (source / functions) Hit Total Coverage
Test: PostgreSQL 15devel Lines: 10 10 100.0 %
Date: 2021-12-03 04:09:03 Functions: 3 3 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-2021, 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           4 :     pg_prng_fseed(&private->random_state, seed);
      25           4 : }
      26             : 
      27             : double
      28         520 : geqo_rand(PlannerInfo *root)
      29             : {
      30         520 :     GeqoPrivateData *private = (GeqoPrivateData *) root->join_search_private;
      31             : 
      32         520 :     return pg_prng_double(&private->random_state);
      33             : }
      34             : 
      35             : int
      36        1540 : geqo_randint(PlannerInfo *root, int upper, int lower)
      37             : {
      38        1540 :     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        1540 :     return (int) pg_prng_uint64_range(&private->random_state, lower, upper);
      45             : }

Generated by: LCOV version 1.14