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:
parent
d452bea037
commit
8400d51420
@ -415,6 +415,13 @@ void RNGClass::begin(const char *tag)
|
|||||||
// Stir in the unique identifier for the CPU so that different
|
// Stir in the unique identifier for the CPU so that different
|
||||||
// devices will give different outputs even without seeding.
|
// devices will give different outputs even without seeding.
|
||||||
stirUniqueIdentifier();
|
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
|
#endif
|
||||||
|
|
||||||
#if defined(RNG_WATCHDOG)
|
#if defined(RNG_WATCHDOG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user