Function coap_prng_try_fill

Source
pub fn coap_prng_try_fill(dest: &mut [u8]) -> Result<(), RngError>
Expand description

Attempts to fill dest with random bytes using libcoap’s PRNG.

§Errors

Will return an error if libcoap’s PRNG has an error or the underlying mutex was poisoned by a panic in another thread.

§Example

use libcoap_rs::error::RngError;
use libcoap_rs::prng::coap_prng_try_fill;

let mut token = [0u8; 8];
coap_prng_try_fill(&mut token)?;