xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_randomness.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_RANDOMNESS 3
3.Os
4.Sh NAME
5.Nm sqlite3_randomness
6.Nd pseudo-Random number generator
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft void
10.Fo sqlite3_randomness
11.Fa "int N"
12.Fa "void *P"
13.Fc
14.Sh DESCRIPTION
15SQLite contains a high-quality pseudo-random number generator (PRNG)
16used to select random ROWIDs when inserting new records into
17a table that already uses the largest possible ROWID.
18The PRNG is also used for the built-in random() and randomblob() SQL
19functions.
20This interface allows applications to access the same PRNG for other
21purposes.
22.Pp
23A call to this routine stores N bytes of randomness into buffer P.
24The P parameter can be a NULL pointer.
25.Pp
26If this routine has not been previously called or if the previous call
27had N less than one or a NULL pointer for P, then the PRNG is seeded
28using randomness obtained from the xRandomness method of the default
29sqlite3_vfs object.
30If the previous call to this routine had an N of 1 or more and a non-NULL
31P then the pseudo-randomness is generated internally and without recourse
32to the sqlite3_vfs xRandomness method.
33.Sh IMPLEMENTATION NOTES
34These declarations were extracted from the
35interface documentation at line 3101.
36.Bd -literal
37SQLITE_API void sqlite3_randomness(int N, void *P);
38.Ed
39.Sh SEE ALSO
40.Xr sqlite3_vfs 3
41