]> Skullheadx's Git Forge - qrcodescanner.git/commitdiff
. gpio-and-power-drawing
authorSkullheadx <admonty1@gmail.com>
Sun, 27 Oct 2024 20:10:40 +0000 (16:10 -0400)
committerSkullheadx <admonty1@gmail.com>
Sun, 27 Oct 2024 20:10:40 +0000 (16:10 -0400)
qrgenerator.cpp [new file with mode: 0644]

diff --git a/qrgenerator.cpp b/qrgenerator.cpp
new file mode 100644 (file)
index 0000000..ca23fb4
--- /dev/null
@@ -0,0 +1,27 @@
+#include <cstdlib>
+#include <iostream>
+#include <cassert>
+
+
+std::string generate_id(unsigned int seed);
+
+
+int main() {
+       std::cout << generate_id(69);
+       return 0;
+
+}
+
+std::string generate_id(unsigned int seed){
+       srand(seed);
+       const unsigned int ID_LENGTH = 34;
+       std::string ID{};
+       std::cout << ID << std::endl;
+       for (int i{0}; i < ID_LENGTH; ++i) {
+               unsigned int digit{};
+               digit = 10 * (((double) rand()) / RAND_MAX);
+               ID += std::to_string(digit);
+       }
+       assert(ID.length() == ID_LENGTH);
+       return ID;
+}