mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-11 15:16:54 +08:00
Use define for RandomDouble
This commit is contained in:
@@ -9,18 +9,11 @@
|
|||||||
#include "common/pg_prng.h"
|
#include "common/pg_prng.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Random double
|
|
||||||
*/
|
|
||||||
static inline double
|
|
||||||
RandomDouble()
|
|
||||||
{
|
|
||||||
#if PG_VERSION_NUM >= 150000
|
#if PG_VERSION_NUM >= 150000
|
||||||
return pg_prng_double(&pg_global_prng_state);
|
#define RandomDouble() (pg_prng_double(&pg_global_prng_state))
|
||||||
#else
|
#else
|
||||||
return (((double) random()) / MAX_RANDOM_VALUE);
|
#define RandomDouble() (((double) random()) / MAX_RANDOM_VALUE)
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize with kmeans++
|
* Initialize with kmeans++
|
||||||
|
|||||||
Reference in New Issue
Block a user