PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <math.h>
#include "common/pg_prng.h"
#include "miscadmin.h"
#include "utils/fmgrprotos.h"
#include "utils/numeric.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Functions | |
static void | initialize_prng (void) |
Datum | setseed (PG_FUNCTION_ARGS) |
Datum | drandom (PG_FUNCTION_ARGS) |
Datum | drandom_normal (PG_FUNCTION_ARGS) |
Datum | int4random (PG_FUNCTION_ARGS) |
Datum | int8random (PG_FUNCTION_ARGS) |
Datum | numeric_random (PG_FUNCTION_ARGS) |
Variables | |
static pg_prng_state | prng_state |
static bool | prng_seed_set = false |
Datum drandom | ( | PG_FUNCTION_ARGS | ) |
Definition at line 84 of file pseudorandomfuncs.c.
References initialize_prng(), pg_prng_double(), PG_RETURN_FLOAT8, and prng_state.
Datum drandom_normal | ( | PG_FUNCTION_ARGS | ) |
Definition at line 102 of file pseudorandomfuncs.c.
References initialize_prng(), PG_GETARG_FLOAT8, pg_prng_double_normal(), PG_RETURN_FLOAT8, and prng_state.
|
static |
Definition at line 34 of file pseudorandomfuncs.c.
References GetCurrentTimestamp(), MyProcPid, now(), pg_prng_seed(), pg_prng_strong_seed, prng_seed_set, prng_state, and unlikely.
Referenced by drandom(), drandom_normal(), int4random(), int8random(), and numeric_random().
Datum int4random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 126 of file pseudorandomfuncs.c.
References ereport, errcode(), errmsg(), ERROR, initialize_prng(), PG_GETARG_INT32, pg_prng_int64_range(), PG_RETURN_INT32, and prng_state.
Datum int8random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 150 of file pseudorandomfuncs.c.
References ereport, errcode(), errmsg(), ERROR, initialize_prng(), PG_GETARG_INT64, pg_prng_int64_range(), PG_RETURN_INT64, and prng_state.
Datum numeric_random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 174 of file pseudorandomfuncs.c.
References initialize_prng(), PG_GETARG_NUMERIC, PG_RETURN_NUMERIC, prng_state, and random_numeric().
Datum setseed | ( | PG_FUNCTION_ARGS | ) |
Definition at line 62 of file pseudorandomfuncs.c.
References ereport, errcode(), errmsg(), ERROR, PG_GETARG_FLOAT8, pg_prng_fseed(), PG_RETURN_VOID, prng_seed_set, and prng_state.
Referenced by assign_random_seed().
Definition at line 26 of file pseudorandomfuncs.c.
Referenced by initialize_prng(), and setseed().
|
static |
Definition at line 25 of file pseudorandomfuncs.c.
Referenced by choose_dsm_implementation(), drandom(), drandom_normal(), initialize_prng(), int4random(), int8random(), numeric_random(), and setseed().