Go to the documentation of this file.
5 double rweibullHR(
double shape,
double scale,
double hr){
6 return R::rweibull(shape, scale*pow(hr,1.0/shape));
19 static double rn = 0.0;
45 for(
int i=0; i<6; i++) {
55 for(
int i=0; i<6; i++) {
56 outseed[i] = (double)seed[i];
67 for (
int i=0; i<6; i++)
72 for (
int i=0; i<6; i++)
73 inoutseed[i]= seed[i];
79 REprintf(
"user_unif_rand(): No stream created yet!");
104 while ((x=R::rnorm(mean,sd))<0.0) { }
109 double u = R::runif(0.0,1.0);
110 return scale*exp(-log(1.0/u-1.0)/shape);
114 double S0 = 1.0/(1.0+exp(log(left/scale)*shape));
115 double u = R::runif(0.0,1.0);
116 return scale*exp(log(1.0/(u*S0)-1.0)/shape);
120 double u = 1.0 - R::runif(0.0, 1.0);
121 return (shape < 0.0 && u<exp(rate/shape)) ? R_PosInf :
122 log(1.0 - shape*log(u)/rate)/shape;
void r_create_current_stream()
A utility function to create the current_stream. Used when initialising the microsimulation package i...
static bool SetPackageSeed(const double seed[6])
double rgompertz(double shape, double rate)
Random draw from a Gompertz distribution.
Time simTime()
simTime() function for OMNET++ API compatibility
static Rng * default_stream
void AdvanceSubstream(int32_t e, int32_t c)
double rllogis_trunc(double shape, double scale, double left)
rllogis_trunc function for a random covariate from a log-logistic distribution with shape and scale w...
#define WithRNG(rng, expr)
WithRNG is a macro for using the random number generator rng and then evaluating the expression expr.
void r_set_user_random_seed(double *inseed)
A utility function to set the user random seed for the simulation.
Time now()
now() function for compatibility with C++SIM
static Rng * current_stream
bool SetSeed(const double seed[6])
double rllogis(double shape, double scale)
rllogis function for a random covariate from a log-logistic distribution with shape and scale....
void r_remove_current_stream()
A utility function to remove the current_stream. Used when finalising the microsimulation package in ...
void ResetNextSubstream()
void GetState(double seed[6]) const
static Time clock()
returns the current virtual time for the current process
void r_rng_advance_substream(double *inoutseed, int *n)
A utility function to advance the random sub-stream n steps for a specified seed.
double Time
virtual time type
name space for the Siena simulator.
double rweibullHR(double shape, double scale, double hr)
Random Weibull distribution for a given shape, scale and hazard ratio.
void r_get_user_random_seed(double *outseed)
A utility function to set the user random seed for the simulation.
void r_next_rng_substream()
A utility function to move to the next user random stream for the simulation.
void test_rstream2(double *x)
Simple test of the random streams (with a stupid name)
double rnormPos(double mean, double sd)
rnorm function constrained to be positive. This uses brute-force re-sampling rather than conditioning...
double * user_unif_rand()