mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-06 05:51:21 +08:00
Set random seed for IVFFLAT_BENCH [skip ci]
This commit is contained in:
@@ -1023,6 +1023,10 @@ ivfflatbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
||||
IndexBuildResult *result;
|
||||
IvfflatBuildState buildstate;
|
||||
|
||||
#ifdef IVFFLAT_BENCH
|
||||
SeedRandom(42);
|
||||
#endif
|
||||
|
||||
BuildIndex(heap, index, indexInfo, &buildstate, MAIN_FORKNUM);
|
||||
|
||||
result = (IndexBuildResult *) palloc(sizeof(IndexBuildResult));
|
||||
|
||||
@@ -73,9 +73,11 @@
|
||||
#if PG_VERSION_NUM >= 150000
|
||||
#define RandomDouble() pg_prng_double(&pg_global_prng_state)
|
||||
#define RandomInt() pg_prng_uint32(&pg_global_prng_state)
|
||||
#define SeedRandom(seed) pg_prng_seed(&pg_global_prng_state, seed)
|
||||
#else
|
||||
#define RandomDouble() (((double) random()) / MAX_RANDOM_VALUE)
|
||||
#define RandomInt() random()
|
||||
#define SeedRandom(seed) srandom(seed)
|
||||
#endif
|
||||
|
||||
/* Variables */
|
||||
|
||||
Reference in New Issue
Block a user