Go to the documentation of this file.
10 double rweibullHR(
double shape,
double scale,
double hr){
11 return R::rweibull(shape, scale*pow(hr,1.0/shape));
24 static double rn = 0.0;
50 for(
int i=0; i<6; i++) {
60 for(
int i=0; i<6; i++) {
61 outseed[i] = (double)seed[i];
72 for (
int i=0; i<6; i++)
77 for (
int i=0; i<6; i++)
78 inoutseed[i]= seed[i];
84 REprintf(
"user_unif_rand(): No stream created yet!");
109 while ((x=R::rnorm(mean,sd))<0.0) { }
114 double u = R::runif(0.0,1.0);
115 return scale*exp(-log(1.0/u-1.0)/shape);
119 double S0 = 1.0/(1.0+exp(log(left/scale)*shape));
120 double u = R::runif(0.0,1.0);
121 return scale*exp(log(1.0/(u*S0)-1.0)/shape);
#define WithRNG(rng, expr)
WithRNG is a macro for using the random number generator rng and then evaluating the expression expr.
double * user_unif_rand()
void GetState(double seed[6]) const
void r_create_current_stream()
A utility function to create the current_stream. Used when initialising the microsimulation package i...
Time simTime()
simTime() function for OMNET++ API compatibility
Time now()
now() function for compatibility with C++SIM
double rnormPos(double mean, double sd)
rnorm function constrained to be positive. This uses brute-force re-sampling rather than conditioning...
static Rng * default_stream
static Rng * current_stream
void r_remove_current_stream()
A utility function to remove the current_stream. Used when finalising the microsimulation package in ...
void r_set_user_random_seed(double *inseed)
A utility function to set the user random seed for the simulation.
static Time clock()
returns the current virtual time for the current process
double Time
virtual time type
bool SetSeed(const double seed[6])
void AdvanceSubstream(int32_t e, int32_t c)
double rweibullHR(double shape, double scale, double hr)
Random Weibull distribution for a given shape, scale and hazard ratio.
void r_rng_advance_substream(double *inoutseed, int *n)
A utility function to advance the random sub-stream n steps for a specified seed.
void ResetNextSubstream()
double rllogis(double shape, double scale)
rllogis function for a random covariate from a log-logistic distribution with shape and scale....
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)
name space for the Siena simulator.
static bool SetPackageSeed(const double seed[6])
void r_get_user_random_seed(double *outseed)
A utility function to set the user random seed for the simulation.
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...