UnQLite C/C++ API Reference - Randomness inside foreign functions.
unsigned int unqlite_context_random_num(unqlite_context *pCtx);
int unqlite_context_random_string(unqlite_context *pCtx,char *zBuf,int nBuflen);
Generate random number and/or string inside a foreign function.
UnQLite is shipped with a high-quality pseudo-random number generator (PRNG). The PRNG is also used by the built-in rand() and rand_str() Jx9 functions. 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 an English based alphabet string of length nBuflen (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.
These routines must be called from the same thread in which the application-defined function is running.
Foreign function Call Context.
Random generated number and/or string.