MCPcopy Create free account
hub / github.com/dfranx/SHADERed / threadSafeRandom

Function threadSafeRandom

src/SHADERed/Objects/WebAPI.cpp:33–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 return true;
32 }
33 int threadSafeRandom(int vmin, int vmax)
34 {
35 static thread_local std::mt19937* generator = nullptr;
36 if (!generator) generator = new std::mt19937(clock() + std::hash<std::thread::id>()(std::this_thread::get_id()));
37 std::uniform_int_distribution<int> distribution(vmin, vmax);
38 return distribution(*generator);
39 }
40
41 /* actual functions */
42 void getTips(std::function<void(int, int, const std::string&, const std::string&)> onFetch)

Callers 1

getTipsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected