stm32f1xx-hal icon indicating copy to clipboard operation
stm32f1xx-hal copied to clipboard

add RNG

Open rise0chen opened this issue 4 years ago • 7 comments

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 :)

rise0chen avatar Nov 09 '20 12:11 rise0chen

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.

thalesfragoso avatar Nov 09 '20 17:11 thalesfragoso

It is named by embedded-hal

rise0chen avatar Nov 10 '20 01:11 rise0chen

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

TheZoq2 avatar Nov 10 '20 08:11 TheZoq2

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?

TheZoq2 avatar Nov 18 '20 08:11 TheZoq2

finish

rise0chen avatar Nov 19 '20 07:11 rise0chen

I would still like more public documentation stating the problems with this "RNG" and maybe a type renaming.

thalesfragoso avatar Nov 22 '20 21:11 thalesfragoso

embedded_hal::rng is deprecated in favour of rand_core

burrbull avatar Jul 14 '21 08:07 burrbull