Loading...
Searching...
No Matches
Pseudo Random Numbers
Libcoap Internal API

Internal API for generating pseudo random numbers. More...

Collaboration diagram for Pseudo Random Numbers:

## Functions

void | coap_prng_init_lkd (unsigned int seed)
| Seeds the default random number generation function with the given `seed`.
int | coap_prng_lkd (void *buf, size_t len)
| Fills `buf` with `len` random bytes using the default pseudo random number generator.

## Detailed Description

Internal API for generating pseudo random numbers.

## Function Documentation

## coap_prng_init_lkd()

void coap_prng_init_lkd | ( | 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.

Parameters

  seed | The seed for the pseudo random number generator.

Definition at line 166 of file coap_prng.c.

Here is the caller graph for this function:

## coap_prng_lkd()

int coap_prng_lkd | ( | 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.

Parameters

  buf | The buffer to fill with random bytes.
  len | The number of random bytes to write into `buf`.

Returns
  1 on success, 0 otherwise.

Definition at line 178 of file coap_prng.c.

Here is the caller graph for this function: