|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <math.h>#include "common/pg_prng.h"#include "miscadmin.h"#include "utils/date.h"#include "utils/fmgrprotos.h"#include "utils/numeric.h"#include "utils/timestamp.h"
Go to the source code of this file.
Macros | |
| #define | CHECK_RANGE_BOUNDS(rmin, rmax) |
Variables | |
| static pg_prng_state | prng_state |
| static bool | prng_seed_set = false |
| #define CHECK_RANGE_BOUNDS | ( | rmin, | |
| rmax | |||
| ) |
Definition at line 33 of file pseudorandomfuncs.c.
| Datum date_random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 203 of file pseudorandomfuncs.c.
References CHECK_RANGE_BOUNDS, DATE_IS_NOBEGIN, DATE_IS_NOEND, ereport, errcode(), errmsg(), ERROR, initialize_prng(), PG_GETARG_DATEADT, pg_prng_int64_range(), PG_RETURN_DATEADT, and prng_state.
| Datum drandom | ( | PG_FUNCTION_ARGS | ) |
Definition at line 97 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 115 of file pseudorandomfuncs.c.
References initialize_prng(), PG_GETARG_FLOAT8, pg_prng_double_normal(), PG_RETURN_FLOAT8, and prng_state.
|
static |
Definition at line 47 of file pseudorandomfuncs.c.
References GetCurrentTimestamp(), MyProcPid, now(), pg_prng_seed(), pg_prng_strong_seed, prng_seed_set, prng_state, and unlikely.
Referenced by date_random(), drandom(), drandom_normal(), int4random(), int8random(), numeric_random(), timestamp_random(), and timestamptz_random().
| Datum int4random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 139 of file pseudorandomfuncs.c.
References CHECK_RANGE_BOUNDS, initialize_prng(), PG_GETARG_INT32, pg_prng_int64_range(), PG_RETURN_INT32, and prng_state.
| Datum int8random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 160 of file pseudorandomfuncs.c.
References CHECK_RANGE_BOUNDS, initialize_prng(), PG_GETARG_INT64, pg_prng_int64_range(), PG_RETURN_INT64, and prng_state.
| Datum numeric_random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 181 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 75 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().
| Datum timestamp_random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 229 of file pseudorandomfuncs.c.
References CHECK_RANGE_BOUNDS, ereport, errcode(), errmsg(), ERROR, initialize_prng(), PG_GETARG_TIMESTAMP, pg_prng_int64_range(), PG_RETURN_TIMESTAMP, prng_state, TIMESTAMP_IS_NOBEGIN, and TIMESTAMP_IS_NOEND.
| Datum timestamptz_random | ( | PG_FUNCTION_ARGS | ) |
Definition at line 255 of file pseudorandomfuncs.c.
References CHECK_RANGE_BOUNDS, ereport, errcode(), errmsg(), ERROR, initialize_prng(), PG_GETARG_TIMESTAMPTZ, pg_prng_int64_range(), PG_RETURN_TIMESTAMPTZ, prng_state, TIMESTAMP_IS_NOBEGIN, and TIMESTAMP_IS_NOEND.
|
static |
Definition at line 27 of file pseudorandomfuncs.c.
Referenced by initialize_prng(), and setseed().
|
static |
Definition at line 26 of file pseudorandomfuncs.c.
Referenced by choose_dsm_implementation(), date_random(), drandom(), drandom_normal(), initialize_prng(), int4random(), int8random(), numeric_random(), setseed(), timestamp_random(), and timestamptz_random().