How should random numbers be generated? I’ve got a STM device and have DEVICE_TRNG
enabled. I see the hal/trng_api.h
with functions like trng_init
and trng_get_bytes
but am not sure if I’m supposed to use those from application code.
I’ve looked through the API’s but couldn’t find a public API for the TRNG.
- Are we expected to use the API from
hal/trng_api.h
to generate random numbers (using device TRNG)? - Is there a public API to generate random numbers that I’ve missed?
- Can
std::rand
(cppreference) be used and would that use the device’s hardware TRNG?