1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:52:44 +01:00

sys: random: make fallback seed configurable at compile time

This commit is contained in:
Martine Lenders 2017-10-26 15:56:16 +02:00 committed by Kaspar Schleiser
parent ccf704bab8
commit c52fde668b
2 changed files with 9 additions and 1 deletions

View File

@ -32,6 +32,14 @@
extern "C" {
#endif
#ifndef RANDOM_DEFAULT_SEED
/**
* @brief Seed selected when all tries to collect seeds from a random source
* failed
*/
#define RANDOM_DEFAULT_SEED (1)
#endif
/**
* @brief Enables support for floating point random number generation
*/

View File

@ -34,7 +34,7 @@ void auto_init_random(void)
luid_get(&seed, 4);
#else
LOG_WARNING("random: NO SEED AVAILABLE!\n");
seed = 1;
seed = RANDOM_SEED_DEFAULT;
#endif
DEBUG("random: using seed value %u\n", (unsigned)seed);
random_init(seed);