MCPcopy Create free account
hub / github.com/Norbyte/ositools / RandomReal

Function RandomReal

OsiInterface/Functions/MathFunctions.cpp:12–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 std::unique_ptr<std::mt19937_64> OsiRng;
11
12 bool RandomReal(OsiArgumentDesc & args)
13 {
14 auto min = args[0].Float;
15 auto max = args[1].Float;
16
17 if (!OsiRng) {
18 OsiRng = std::make_unique<std::mt19937_64>();
19 time_t tm;
20 OsiRng->seed(time(&tm));
21 }
22
23 std::uniform_real_distribution<float> dist(min, max);
24 args[2].Float = dist(*OsiRng);
25 return true;
26 }
27
28 bool Sin(OsiArgumentDesc & args)
29 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected