summaryrefslogtreecommitdiff
path: root/src/include/utils/sampling.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/utils/sampling.h')
-rw-r--r--src/include/utils/sampling.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/include/utils/sampling.h b/src/include/utils/sampling.h
index a58d14281b..74ce8f9dc3 100644
--- a/src/include/utils/sampling.h
+++ b/src/include/utils/sampling.h
@@ -13,15 +13,14 @@
#ifndef SAMPLING_H
#define SAMPLING_H
+#include "common/pg_prng.h"
#include "storage/block.h" /* for typedef BlockNumber */
/* Random generator for sampling code */
-typedef unsigned short SamplerRandomState[3];
-
-extern void sampler_random_init_state(long seed,
- SamplerRandomState randstate);
-extern double sampler_random_fract(SamplerRandomState randstate);
+extern void sampler_random_init_state(uint32 seed,
+ pg_prng_state *randstate);
+extern double sampler_random_fract(pg_prng_state *randstate);
/* Block sampling methods */
@@ -32,13 +31,13 @@ typedef struct
int n; /* desired sample size */
BlockNumber t; /* current block number */
int m; /* blocks selected so far */
- SamplerRandomState randstate; /* random generator state */
+ pg_prng_state randstate; /* random generator state */
} BlockSamplerData;
typedef BlockSamplerData *BlockSampler;
extern BlockNumber BlockSampler_Init(BlockSampler bs, BlockNumber nblocks,
- int samplesize, long randseed);
+ int samplesize, uint32 randseed);
extern bool BlockSampler_HasMore(BlockSampler bs);
extern BlockNumber BlockSampler_Next(BlockSampler bs);
@@ -47,7 +46,7 @@ extern BlockNumber BlockSampler_Next(BlockSampler bs);
typedef struct
{
double W;
- SamplerRandomState randstate; /* random generator state */
+ pg_prng_state randstate; /* random generator state */
} ReservoirStateData;
typedef ReservoirStateData *ReservoirState;