Skip to content

Commit 4c375c0

Browse files
committed
ubuntu: Seed the RNG on startup
1 parent 9dd150c commit 4c375c0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

platforms/ubuntu/src/ubuntu_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616

1717
#include <signal.h>
18+
#include <sys/types.h>
1819
#include <sys/wait.h>
20+
#include <time.h>
21+
#include <unistd.h>
1922

2023
#include "common/queue.h"
2124

@@ -235,5 +238,7 @@ enum mgos_init_result mongoose_init(void) {
235238

236239
mgos_invoke_cb(ubuntu_net_up, NULL, false /* from_isr */);
237240

241+
srand(time(NULL) + getpid());
242+
238243
return mgos_init();
239244
}

0 commit comments

Comments
 (0)