Symisc UnQLite

An Embeddable NoSQL Database Engine



UnQLite C/C++ API Reference - Randomness.

Syntax

int unqlite_util_random_string(unqlite *pDb,char *zBuf,unsigned int buf_size);
unsigned int unqlite_util_random_num(unqlite *pDb);


Generate random number and/or string using the UnQLite PRNG.


Description


UnQLite is shipped with a high-quality pseudo-random number generator (PRNG). These interfaces allows host-applications to access the same PRNG for other purposes.


unqlite_context_random_num() returns a 32-bit unsigned integer between 0 and 0xFFFFFFFF.


unqlite_context_random_string() generate a english alphabet based string of length buf_size (last argument). Note that the generated string is not null terminated and the given buffer must be big enough to hold at least 3 bytes.


Parameters


pDb

A pointer to a UnQLite database handle.


Return value


Random generated number and/or string.


Example


Compile this C file for a smart introduction to these interfaces.


See also


unqlite_util_load_mmaped_file.



Symisc Systems
Copyright © Symisc Systems