|
AndroMeta
2.0.0
|
00001 /* 00002 * Copyright 2009-2012 AndroMeta LLC. All rights reserved. 00003 * 00004 * AndroMeta LLC retains all intellectual property and proprietary 00005 * rights to this software and related documentation and any modifications 00006 * thereto. Any use, reproduction, disclosure, or distribution of this 00007 * software and related documentation without an express license agreement 00008 * from AndroMeta LLC is strictly prohibited. 00009 * 00010 */ 00011 00018 #ifndef ANDROMETA_M_RANDOM_H 00019 #define ANDROMETA_M_RANDOM_H 00020 00021 #include <AndroMeta/MObject.h> 00022 00023 namespace Meta{ 00024 00032 class MRandom : public MObject{ 00033 public: 00034 00038 MRandom(uint64_t seed=0); 00039 00043 MRandom(const mvar& v, RestoreOpt opt); 00044 00048 MRandom(const MRandom& random); 00049 00053 ~MRandom(); 00054 00058 void store(mvar& v) const; 00059 00063 MObject* clone() const; 00064 00068 void setSeed(uint64_t seed); 00069 00075 uint64_t timeSeed(); 00076 00080 double uniform(); 00081 00085 double uniform(double a, double b); 00086 00091 double exponential(double x); 00092 00097 double normal(double m, double s); 00098 00103 double erlang(double n, double x); 00104 00110 double pareto(double k, double a); 00111 00117 double lognormal(double a, double b); 00118 00123 double chisquare(double n); 00124 00125 // ---- discrete distributions 00126 00131 long bernoulli(double p); 00132 00138 long equilikely(long a, long b); 00139 00144 long binomial(long n, double p); 00145 00150 long geometric(double p); 00151 00156 long bpascal(long n, double p); 00157 00162 long poisson(double m); 00163 00167 mvec sequence(long a, long b); 00168 00172 virtual mnode process(mnode n, uint32_t flags=0); 00173 00174 private: 00175 MRandom& operator=(const MRandom&); 00176 00177 class MRandom_* x_; 00178 }; 00179 00180 } // end namespace Meta 00181 00182 #endif // ANDROMETA_M_RANDOM_H
1.7.6.1