LSP: OpenGOAL Feature Support - Part 1 (#2668)

This commit is contained in:
Tyler Wilding
2023-05-21 16:24:23 -05:00
committed by GitHub
parent d5951c2b11
commit 057ae361bf
109 changed files with 8032 additions and 7956 deletions
+20
View File
@@ -1,5 +1,6 @@
#include "string_util.h"
#include <random>
#include <regex>
#include "common/util/diff.h"
@@ -101,4 +102,23 @@ bool replace(std::string& str, const std::string& from, const std::string& to) {
str.replace(start_pos, from.length(), to);
return true;
}
std::string uuid() {
static std::random_device dev;
static std::mt19937 rng(dev());
std::uniform_int_distribution<int> dist(0, 15);
const char* v = "0123456789abcdef";
const bool dash[] = {0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0};
std::string res;
for (int i = 0; i < 16; i++) {
if (dash[i])
res += "-";
res += v[dist(rng)];
res += v[dist(rng)];
}
return res;
}
} // namespace str_util