![]() |
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | as_random |
Functions | |
static void | as_random_get_bytes (uint8_t *bytes, uint32_t len) |
static uint32_t | as_random_get_uint32 () |
uint64_t | as_random_get_uint64 () |
void | as_random_init (as_random *random) |
static as_random * | as_random_instance () |
void | as_random_next_bytes (as_random *random, uint8_t *bytes, uint32_t len) |
static uint32_t | as_random_next_uint32 (as_random *random) |
static uint64_t | as_random_next_uint64 (as_random *random) |
Variables | |
__thread as_random | as_rand |
|
inlinestatic |
Get random bytes of specified length from thread local instance.
Definition at line 119 of file as_random.h.
References as_random_instance(), and as_random_next_bytes().
|
inlinestatic |
Get random unsigned 32 bit integer from thread local instance.
Definition at line 110 of file as_random.h.
References as_random_get_uint64().
uint64_t as_random_get_uint64 | ( | ) |
Get random unsigned 64 bit integer from thread local instance.
void as_random_init | ( | as_random * | random) |
Initialize random instance.
|
inlinestatic |
Get thread local random instance.
Definition at line 59 of file as_random.h.
References as_random_init(), and as_random::initialized.
void as_random_next_bytes | ( | as_random * | random, |
uint8_t * | bytes, | ||
uint32_t | len | ||
) |
Get random bytes of specified length from given as_random instance.
|
inlinestatic |
Get random unsigned 32 bit integer from given as_random instance.
Definition at line 89 of file as_random.h.
References as_random_next_uint64().
|
inlinestatic |
Get random unsigned 64 bit integer from given as_random instance using xorshift128+ algorithm: http://xorshift.di.unimi.it
Definition at line 74 of file as_random.h.
References as_random::seed0, and as_random::seed1.
__thread as_random as_rand |
Thread local random instance. Do not access directly.