setseed()

A function for setting the random number generator seed

setseed() is a system function for setting the random number generator seed used in subsequent calls to the random() function.

setseed() was added in PostgreSQL 7.0.

Usage

setseed ( double precision ) → void

The provided value must be in the range -1 to 1.

Note that SET SEED TO double precision is equivalent to calling this function.

Change history

Examples

Basic usage example for setseed():

postgres=# SELECT setseed(-0.1);
 setseed 
---------
 
(1 row)

Attempting to provide an invalue seed value:

postgres=# SELECT setseed(99);
ERROR:  setseed parameter 99 is out of allowed range [-1,1]

Categories

System function

See also

random()