|
libcoap 4.3.5-develop-13abce9
|
API for generating pseudo random numbers. More...
Collaboration diagram for Pseudo Random Numbers:Typedefs | |
| typedef int(* | coap_rand_func_t) (void *out, size_t len) |
| Data type for random number generator function. | |
Functions | |
| void | coap_set_prng (coap_rand_func_t rng) |
Replaces the current random number generation function with the default function rng. | |
| COAP_API void | coap_prng_init (unsigned int seed) |
Seeds the default random number generation function with the given seed. | |
| COAP_API int | coap_prng (void *buf, size_t len) |
Fills buf with len random bytes using the default pseudo random number generator. | |
API for generating pseudo random numbers.
| typedef int(* coap_rand_func_t) (void *out, size_t len) |
Data type for random number generator function.
The function must fill len bytes of random data into the buffer starting at out. On success, the function should return 1, zero otherwise.
Definition at line 36 of file coap_prng.h.
| COAP_API int coap_prng | ( | void * | buf, |
| size_t | len | ||
| ) |
Fills buf with len random bytes using the default pseudo random number generator.
The default PRNG can be changed with coap_set_prng(). This function returns 1 when len random bytes have been written to buf, zero otherwise.
| buf | The buffer to fill with random bytes. |
| len | The number of random bytes to write into buf. |
Definition at line 69 of file coap_prng.c.
Here is the call graph for this function:| COAP_API void coap_prng_init | ( | unsigned int | seed | ) |
Seeds the default random number generation function with the given seed.
The default random number generation function will use getrandom() if available, ignoring the seed.
| seed | The seed for the pseudo random number generator. |
Definition at line 62 of file coap_prng.c.
Here is the call graph for this function:| void coap_set_prng | ( | coap_rand_func_t | rng | ) |
Replaces the current random number generation function with the default function rng.
| rng | The random number generation function to use. |
Definition at line 173 of file coap_prng.c.