1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Use __TIME__ and __DATE__ to provide the RNG a compile-time seed

This commit is contained in:
Rhys Weatherley 2017-11-25 05:39:42 +10:00
parent d452bea037
commit 8400d51420

View File

@ -415,6 +415,13 @@ void RNGClass::begin(const char *tag)
// Stir in the unique identifier for the CPU so that different
// devices will give different outputs even without seeding.
stirUniqueIdentifier();
#else
// AVR devices don't have anything like a serial number so it is
// difficult to make every device unique. Use the compilation
// time and date to provide a little randomness across applications
// if not across devices running the same pre-compiled application.
tag = __TIME__ __DATE__;
stir((const uint8_t *)tag, strlen(tag));
#endif
#if defined(RNG_WATCHDOG)