00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __DISTRIB_H_
00020 #define __DISTRIB_H_
00021
00022 #include "simkerneldefs.h"
00023 #include "random.h"
00024 #include "simtime.h"
00025
00026 NAMESPACE_BEGIN
00027
00033
00040 SIM_API double uniform(double a, double b, int rng=0);
00041
00045 inline SimTime uniform(SimTime a, SimTime b, int rng=0) {return uniform(a.dbl(), b.dbl(), rng);}
00046
00054 SIM_API double exponential(double mean, int rng=0);
00055
00059 inline SimTime exponential(SimTime mean, int rng=0) {return exponential(mean.dbl(), rng);}
00060
00069 SIM_API double normal(double mean, double stddev, int rng=0);
00070
00074 inline SimTime normal(SimTime mean, SimTime stddev, int rng=0) {return normal(mean.dbl(), stddev.dbl(), rng);}
00075
00091 SIM_API double truncnormal(double mean, double stddev, int rng=0);
00092
00096 inline SimTime truncnormal(SimTime mean, SimTime stddev, int rng=0) {return truncnormal(mean.dbl(), stddev.dbl(), rng);}
00097
00133 SIM_API double gamma_d(double alpha, double theta, int rng=0);
00134
00147 SIM_API double beta(double alpha1, double alpha2, int rng=0);
00148
00167 SIM_API double erlang_k(unsigned int k, double mean, int rng=0);
00168
00184 SIM_API double chi_square(unsigned int k, int rng=0);
00185
00197 SIM_API double student_t(unsigned int i, int rng=0);
00198
00213 SIM_API double cauchy(double a, double b, int rng=0);
00214
00224 SIM_API double triang(double a, double b, double c, int rng=0);
00225
00237 inline double lognormal(double m, double w, int rng=0)
00238 {
00239 return exp(normal(m, w, rng));
00240 }
00241
00261 SIM_API double weibull(double a, double b, int rng=0);
00262
00272 SIM_API double pareto_shifted(double a, double b, double c, int rng=0);
00273
00275
00281
00289 SIM_API int intuniform(int a, int b, int rng=0);
00290
00300 inline int bernoulli(double p, int rng=0)
00301 {
00302 double U = genk_dblrand(rng);
00303 return (p > U) ? 1 : 0;
00304 }
00305
00318 SIM_API int binomial(int n, double p, int rng=0);
00319
00332 SIM_API int geometric(double p, int rng=0);
00333
00346 SIM_API int negbinomial(int n, double p, int rng=0);
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00382 SIM_API int poisson(double lambda, int rng=0);
00383
00385
00386 NAMESPACE_END
00387
00388
00389 #endif
00390