The SQLite random() function returns a random integer between -9223372036854775808 and +9223372036854775807.
Syntax #
random()Arguments #
The random() function takes no argument.
Return Type #
Integer
Examples #
The following statement uses the random() function to return a random integer.
SELECT random();random()
-------------------
8713427140561224584If the number of rows in a table is small, you can use the random() function to get a number of random rows.
For example, the following example uses the random() function to retrieve 5 random albums from the albums table:
SELECT title
FROM albums
ORDER BY random()
LIMIT 5;Output:
Title
-------------------------
Deep Purple In Rock
Live After Death
A Matter of Life and Death
Na Pista
The Best Of 1980-1990Thank you for your feedback!