/** * @file SynapticRandomizer.hpp * * Random initial values for synaptic weights. Create and seed one for * each thread separately. */ #ifndef SYNAPTIC_RANDOMIZER_ #define SYNAPTIC_RANDOMIZER_ #include using namespace std; namespace jymlp{ class SynapticRandomizer{ protected: mt19937 *generator = nullptr; public: SynapticRandomizer() = delete; /** * Construct using a shared Mersenne Twister generator. The * pointer may be shared within the thread for other purposes, * but not among multiple threads. Create one for each thread. */ SynapticRandomizer(mt19937 *igenerator); /** Default operation: Draw a double from U([-1,1])*/ double rndU1(); /** Draw a double from U([-a,a])*/ double rndU(double a); }; } #endif