We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9ff039 commit 9e6d0baCopy full SHA for 9e6d0ba
include/tomo_rng_engine.h
@@ -0,0 +1,12 @@
1
+#ifndef TOMO_UTIL_H
2
+#define TOMO_UTIL_H
3
+
4
+#include <stdint.h>
5
6
+class TomoRNGEngine final {
7
+public:
8
+ static void initializeEngine();
9
+ static uint8_t get(uint8_t min, uint8_t max);
10
+};
11
12
+#endif
src/tomo_rng_engine.cpp
@@ -0,0 +1,13 @@
+#include <Arduino.h>
+#include <bootloader_random.h>
+#include <tomo_rng_engine.h>
+void TomoRNGEngine::initializeEngine() {
+ bootloader_random_enable();
+ randomSeed(esp_random());
+ bootloader_random_disable();
+}
+uint8_t TomoRNGEngine::get(uint8_t min, uint8_t max) {
+ return (uint8_t) random(min, max);
13
0 commit comments