changes in tmp dir

This commit is contained in:
vaclavt
2022-01-18 23:47:45 +01:00
parent 46baf4aa4f
commit caf118f4f6
2 changed files with 34 additions and 5 deletions

View File

@@ -1,5 +0,0 @@
(print
"ahoj"
; this comment is problem
)
(print "lisp")

34
tmp/uuid.cpp Normal file
View File

@@ -0,0 +1,34 @@
// https://mariusbancila.ro/blog/2018/02/27/stduuid-a-cpp-library-for-universally-unique-identifiers/
// #pragma once
#include <string>
#include <random>
#include <iostream>
std::string get_uuid() {
static std::random_device dev;
static std::mt19937_64 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;
res.reserve(40);
for (int i = 0; i < 16; i++) {
if (dash[i]) res += "-";
res += v[dist(rng)];
res += v[dist(rng)];
}
return res;
}
// g++ uuid_test.cpp
int main() {
auto uuid_str = get_uuid();
std::cout << uuid_str << std::endl;
}