stm32f1xx-hal
stm32f1xx-hal copied to clipboard
add RNG
Thanks for contributing to the project!
Please write a short description of your changes.
We also maintain a changelog in CHANGELOG.md. If you add a feature or fix a bug, please add an entry there :)
Thanks for your contribution, but one thing, I'm really uncomfortable calling this a RNG, this feature is nice and can help a lot of people, but I think we should name it accordingly to avoid confusion.
It is named by embedded-hal
I agree with thales here. I think the embedded-hal RNG is supposed to refer to an actual random number generator that has nice properties, perhaps even one that is cryptographically sound. I'll have to look into it a bit more though
Finally found some time to look into this. Consensus on what the requirements on RNG trait requirements don't seem to be super clear but given that, I'd say we can use this as long as we label it as what it is.
Jamesmunns also pointed out this: https://github.com/jamesmunns/knurling-test-adapter/blob/main/crates/stm32f4-prng/src/lib.rs which is using a similar method to seed a proper pseudo RNG which should give more "predictable" results.
If nothing else, would you mind adding some documentation to your code describing how this gets its randomness and what properties it has?
finish
I would still like more public documentation stating the problems with this "RNG" and maybe a type renaming.
embedded_hal::rng
is deprecated in favour of rand_core