MCPcopy Create free account
hub / github.com/ArashPartow/exprtk / rnd_01

Class rnd_01

exprtk_simple_example_17.cpp:29–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template <typename T>
29struct rnd_01 : public exprtk::ifunction<T>
30{
31 using exprtk::ifunction<T>::operator();
32
33 rnd_01() : exprtk::ifunction<T>(0)
34 { ::srand(static_cast<unsigned int>(time(NULL))); }
35
36 inline T operator()()
37 {
38 // Note: Do not use this in production
39 // Result is in the interval [0,1)
40 return T(::rand() / T(RAND_MAX + 1.0));
41 }
42};
43
44template <typename T>
45void monte_carlo_pi()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected