| 27 | |
| 28 | template <typename T> |
| 29 | struct 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 | |
| 44 | template <typename T> |
| 45 | void monte_carlo_pi() |
nothing calls this directly
no outgoing calls
no test coverage detected