Functions to get randomness.
More...
#include <freeradius-devel/util/rand.h>
#include <freeradius-devel/util/hash.h>
#include <fcntl.h>
#include <stdbool.h>
Go to the source code of this file.
Functions to get randomness.
- Copyright
- 1999-2017 The FreeRADIUS server project
Definition in file rand.c.
◆ fill
Value:do { \
while (p < end) { \
if ((mod = ((p -
out) & (
sizeof(word) - 1))) == 0) word =
fr_rand(); \
*p++ = (_expr); \
uint32_t fr_rand(void)
Return a 32-bit random number.
static size_t char ** out
◆ fr_fast_rand()
◆ fr_rand()
Return a 32-bit random number.
Definition at line 105 of file rand.c.
◆ fr_rand_buffer()
void fr_rand_buffer |
( |
void * |
start, |
|
|
size_t |
length |
|
) |
| |
◆ fr_rand_init()
void fr_rand_init |
( |
void |
| ) |
|
◆ fr_rand_mixin()
void fr_rand_mixin |
( |
void const * |
data, |
|
|
size_t |
size |
|
) |
| |
Mix data into the random number generator.
May be called any number of times.
Definition at line 79 of file rand.c.
◆ fr_rand_str()
Generate a random string.
- Note
- Character selection is not perfectly distributed, should not be used for cryptographic purposes.
- Parameters
-
[out] | out | Where to write the string |
[in] | len | Length of the output buffer. |
[in] | class | to pick characters from (see function body). |
Definition at line 163 of file rand.c.
◆ fr_rand_initialized
_Thread_local bool fr_rand_initialized = false |
|
static |
◆ fr_rand_pool
A pool of pre-generated random integers.
Definition at line 31 of file rand.c.