RANDOMINT_crypto

Accepts and returns an INT8 value. RANDOMINT_crypto (n) returns one of the n integers from 0 through n - 1. For this cryptographic random number generator, Vertica uses RAND_bytes to provide the random value.

Behavior Type

Volatile

Syntax

RANDOMINT_crypto ( n ) 

Parameters

The value accepted is any positive integer (n) between the values 1 and 9,223,372,036,854,775,807.

For general information on integer data types, see INTEGER.

Restrictions

If you provide a negative value, or if you exceed the maximum value, Vertica returns an error.

Examples

In the following example, notice that the result is an INT8, which is >= 0 and < n, randomly chosen from the set {0,1,2,3,4}.

=> SELECT RANDOMINT_crypto(5);
RANDOMINT_crypto
----------------
               3
(1 row)