|
myMPD
Internal API documentation
|
Random number generator functions based on OpenSSL. More...
#include "compile_time.h"#include "src/lib/random.h"#include "src/lib/log.h"#include <assert.h>#include <limits.h>#include <openssl/rand.h>
Functions | |
| unsigned | randrange (unsigned lower, unsigned upper) |
| char | randchar (void) |
| void | randstring (char *buffer, size_t len) |
Variables | |
| static const char * | dict = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" |
| static unsigned | dict_len = 62 |
Random number generator functions based on OpenSSL.
| char randchar | ( | void | ) |
Returns a random ascii char
| unsigned randrange | ( | unsigned | lower, |
| unsigned | upper | ||
| ) |
Generates an unsigned type random number in range (inclusive lower and exclusive upper bound)
| lower | lower boundary |
| upper | upper boundary |
| void randstring | ( | char * | buffer, |
| size_t | len | ||
| ) |
Fills the buffer with random ascii chars and NULL-terminates it.
| buffer | buffer to fill |
| len | length of buffer |
|
static |
Characterset to generate random strings from
|
static |
Characterset length