pcg_random
pgsql_pcg_random · PCG pseudo-random number generator functions for PostgreSQL.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100269 | pcg_random | pgsql_pcg_random | 0.0.1 | FUNC | Apache-2.0 | C |
Usage
Sources:
pcg_random version 0.0.1 exposes scalar, bounded, array, and bounded-array functions backed by a PCG generator. The optional seed argument selects a sequence; the implementation also mixes time and an address into each call.
Example
This is not a cryptographic random source. Pass a strictly positive bound and a small nonnegative array length; the C code does not adequately validate zero/negative bounds or lengths. More importantly, the install SQL declares nondeterministic functions IMMUTABLE, allowing planner constant folding and otherwise incorrect reuse. The source is from 2016 and has no current compatibility matrix; prefer maintained PostgreSQL randomness facilities.