Symisc Vedis

An Embeddable Datastore Engine



Vedis C/C++ API Reference - Foreign Command auxiliary private data.

Syntax

unsigned int vedis_context_random_num(vedis_context *pCtx);

int vedis_context_random_string(vedis_context *pCtx,char *zBuf,int nBuflen);


Generate random number and/or string inside a foreign function.


Description


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


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


vedis_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 interfaces accepts as their first argument a pointer to a vedis_context which mean that they are designed to be invoked only from a foreign command.


These routines must be called from the same thread in which the application-defined function is running.


Parameters


pCtx

 Foreign command call context.


Return value


Random generated number and/or string.


See also


vedis_register_command.



Symisc Systems
Copyright © Symisc Systems