I'm looking for a "good" random number solution in a non-cryptography way. Good just means that it has to be reasonably fast as I'll be using it a lot, and it shouldn't be obviously apparent that it's pseudo-random, even if it is. Initially I was using just the standard randomSeed() and random() functions and it was very obvious that it was repeating itself. I've switched to the Entropy library and just want to confirm my implementation because most of the discussion seems to be around it's effectiveness in cryptography based solutions, but also that it's pretty slow, (compared to what I'm not sure).
Here's what I've got:
.. and then I just use the random() function from the Arduino library through the rest of my application. My understanding is that this gives a much better seed than say randomSeed(analogRead(someUnusedPin)), but is that all I need to get better randomness without going overboard?
Here's what I've got:
Code:
void setup() {
// Lots of set up stuff ...
// ... and these two lines to seed the PRNG
Entropy.Initialize();
randomSeed(Entropy.random());
}
.. and then I just use the random() function from the Arduino library through the rest of my application. My understanding is that this gives a much better seed than say randomSeed(analogRead(someUnusedPin)), but is that all I need to get better randomness without going overboard?