Actually set the rand() seed for Portduino (#4380)

This commit is contained in:
Jonathan Bennett 2024-08-03 13:12:22 -05:00 committed by GitHub
parent d1ff160256
commit 5453c495e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@
#include <Utility.h> #include <Utility.h>
#include <assert.h> #include <assert.h>
#include <time.h>
#include "PortduinoGlue.h" #include "PortduinoGlue.h"
#include "linux/gpio/LinuxGPIOPin.h" #include "linux/gpio/LinuxGPIOPin.h"
@ -134,6 +135,9 @@ void portduinoSetup()
return; return;
} }
// Rather important to set this, if not running simulated.
randomSeed(time(NULL));
try { try {
if (yamlConfig["Logging"]) { if (yamlConfig["Logging"]) {
if (yamlConfig["Logging"]["LogLevel"].as<std::string>("info") == "trace") { if (yamlConfig["Logging"]["LogLevel"].as<std::string>("info") == "trace") {
@ -382,4 +386,4 @@ int initGPIOPin(int pinNum, const std::string gpioChipName)
#else #else
return ERRNO_OK; return ERRNO_OK;
#endif #endif
} }