31 #ifndef __adevs_rand_h_ 32 #define __adevs_rand_h_ 80 virtual void set_seed(
unsigned long seed) = 0;
105 crand(
unsigned long seed):seedp((unsigned int)seed){}
107 void set_seed(
unsigned long seed) { seedp = (
unsigned int)seed; }
112 return ((
double)
next_long()/(
double)UINT_MAX);
114 return ((
double)
next_long()/(
double)RAND_MAX);
135 rv (
unsigned long seed = 1);
144 const rv& operator=(
const rv& src);
151 double triangular(
double a,
double b,
double c);
153 double uniform(
double a,
double b);
158 double normal(
double m,
double s);
165 double exponential(
double a);
166 double hyperexponential(
double p,
double a,
double b);
167 double laplace(
double a);
168 double chisquare(
unsigned int n);
169 double student(
unsigned int n);
170 double lognormal(
double a,
double b);
171 double erlang(
unsigned int n,
double a);
172 double gamma(
double a,
double b);
173 double beta(
double a,
double b);
174 double fdistribution(
unsigned int n,
unsigned int m);
175 double poisson(
double a);
176 double geometric(
double p);
177 double hypergeometric(
unsigned int m,
unsigned int n,
double p);
178 double weibull(
double a,
double b);
179 double binomial(
double p,
unsigned int n);
180 double negativebinomial(
double p,
unsigned int n);
181 double triangular(
double a);
182 int probability(
double p);
183 double lngamma(
double xx);
188 void err(errorType n);
virtual double next_dbl()=0
Get the next double uniformly distributed in [0, 1].
random_seq * copy() const
Copy the random number generator.
Definition: adevs_rand.h:120
~crand()
Destructor.
Definition: adevs_rand.h:122
Definition: adevs_rand.h:76
crand(unsigned long seed)
Create a generator with the given seed.
Definition: adevs_rand.h:105
virtual random_seq * copy() const =0
Copy the random number generator.
virtual void set_seed(unsigned long seed)=0
Set the seed for the random number generator.
Definition: adevs_rand.h:131
crand(const crand &src)
Copy constructor.
Definition: adevs_rand.h:103
void set_seed(unsigned long seed)
Set the seed for the random number generator.
Definition: adevs_rand.h:107
crand()
Create a generator with the default seed.
Definition: adevs_rand.h:101
Definition: adevs_fmi.h:57
double next_dbl()
Get the next double uniformly distributed in [0, 1].
Definition: adevs_rand.h:109
Definition: adevs_rand.h:97
virtual ~random_seq()
Destructor.
Definition: adevs_rand.h:88
virtual unsigned long next_long()=0
Get the next unsigned long.