#pragma once #include "Person.h" #include #include #include class Random { public: Random(unsigned int r) : _rep(r) {} virtual ~Random() {} enum Random_t { Var, Intervention, Model, NRANDOMS }; virtual double uniformDist( unsigned int id, unsigned int process, unsigned int year ) const = 0; virtual double normalDist( unsigned int id, unsigned int process, unsigned int year, double m, double s ) const = 0; /** Generates a random vector draw from the multivariate normal distribution \param[in] id passed as id argument to normalDist when generating component draws \param[in] process each vector element is passed as process argument to normalDist when generating the corresponding component draw. Must be same length as m. \param[in] year passed as year argument to normalDist when generating component draws \param[in] m mean vector for multivariate normal distribution, the length of the random vector draw will be the same length as m \param[in] C Cholesky decomposition of covariance matrix (Covariance = C x CT), lower triangular, stored as vector of vectors containing nonzero elements C[0][0], C[1][0], C[1][1], C[2][0], C[2][1], C[2][2], etc. \return vector of same length as m that contains the multivariate random draw */ virtual std::vector mvnormDist( const unsigned int id, const std::vector& process, unsigned int year, const std::vector& m, const std::vector< std::vector >& C) const; virtual unsigned int randomIndex(unsigned int id, Random_t rand) const = 0; virtual unsigned int rep() const {return _rep;} protected: unsigned int _rep; };