diff --git a/eo/src/utils/eoRNG.h b/eo/src/utils/eoRNG.h index 6fe52e01..9821d6c8 100644 --- a/eo/src/utils/eoRNG.h +++ b/eo/src/utils/eoRNG.h @@ -439,5 +439,25 @@ inline double eoRng::normal(void) return (var2 * factor); } +namespace eo { +// a few convenience functions for generating numbers + + /** + * Templatized random function, works with most basic types such as: + * char + * int + * unsigned + * float + * double + */ + template + inline + T random(const T& mx) { return static_cast(rng.uniform() * mx); } + + /** Normal distribution */ + inline double normal() { return rng.normal(); } +} + + #endif