random
random data generator
Repository
tvondra/random
https://github.com/tvondra/random
Source
random-2.0.0-dev.tar.gz
random-2.0.0-dev.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_random | 2.0.0 | FUNC | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4790 | random | No | Yes | No | Yes | No | Yes | - |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 2.0.0 | 1817161514 | pg_random | - |
| RPM | PIGSTY | 2.0.0 | 1817161514 | pg_random_$v | - |
| DEB | PIGSTY | 2.0.0 | 1817161514 | postgresql-$v-random | - |
Build
You can build the RPM / DEB packages for pg_random using pig build:
Install
You can install pg_random directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
Provides functions to generate random values for various data types with reproducible output controlled by a seed.
Functions
All functions accept seed (for reproducibility) and nvalues (number of distinct values).
| Function | Description |
|---|---|
random_string(seed, nvalues, min_length, max_length) | Random ASCII string |
random_bytea(seed, nvalues, min_length, max_length) | Random bytea |
random_int(seed, nvalues, min_value, max_value) | Random 32-bit integer |
random_bigint(seed, nvalues, min_value, max_value) | Random 64-bit integer |
random_real(seed, nvalues, min_value, max_value) | Random 32-bit float |
random_double_precision(seed, nvalues, min_value, max_value) | Random 64-bit float |
random_inet(seed, nvalues) | Random INET address (/32 mask) |
random_cnet(seed, nvalues) | Random CIDR with masks 8/16/24/32 |
random_cnet2(seed, nvalues) | Random CIDR with equal fraction per mask length |
random_macaddr(seed, nvalues) | Random 6-byte MAC address |
random_macaddr8(seed, nvalues) | Random 8-byte MAC address |
Examples
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)