consume fewer random bytes for slab randomization

This commit is contained in:
Daniel Micay 2018-08-25 18:32:44 -04:00
parent c5d76179a5
commit 2b7c9362bb
3 changed files with 37 additions and 14 deletions

View file

@ -10,10 +10,11 @@ struct random_state {
uint8_t cache[RANDOM_CACHE_SIZE];
};
void get_random_seed(void *buf, size_t size);
void random_state_init(struct random_state *state);
void get_random_bytes(struct random_state *state, void *buf, size_t size);
size_t get_random_size(struct random_state *state);
size_t get_random_size_uniform(struct random_state *state, size_t bound);
uint16_t get_random_u16(struct random_state *state);
uint16_t get_random_u16_uniform(struct random_state *state, uint16_t bound);
uint64_t get_random_u64(struct random_state *state);
uint64_t get_random_u64_uniform(struct random_state *state, uint64_t bound);
#endif