_erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result)
{
union ieee754_double temp;
_erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result)
{
union ieee754_double temp;
/* Compute next state. */
if (_drand48_iterate(xsubi, buffer) < 0)
return -1;
/* Compute next state. */
if (_drand48_iterate(xsubi, buffer) < 0)
return -1;
/* Construct a positive double with the 48 random bits distributed over
its fractional part so the resulting FP number is [0.0,1.0). */
/* Construct a positive double with the 48 random bits distributed over
its fractional part so the resulting FP number is [0.0,1.0). */
temp.ieee.negative = 0;
temp.ieee.exponent = IEEE754_DOUBLE_BIAS;
temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12);
temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4);
temp.ieee.negative = 0;
temp.ieee.exponent = IEEE754_DOUBLE_BIAS;
temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12);
temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4);
/* Do the real work. We choose a data type which contains at least
48 bits. Because we compute the modulus it does not care how
many bits really are computed. */
/* Do the real work. We choose a data type which contains at least
48 bits. Because we compute the modulus it does not care how
many bits really are computed. */
xsubi[0] = result & 0xffff;
xsubi[1] = (result >> 16) & 0xffff;
xsubi[2] = (result >> 32) & 0xffff;
xsubi[0] = result & 0xffff;
xsubi[1] = (result >> 16) & 0xffff;
xsubi[2] = (result >> 32) & 0xffff;
_rand(void)
{
const long a = 16807;
const long m = 2147483647;
const long q = 127773; /* (m/a) */
const long r = 2836; /* (m%a) */
_rand(void)
{
const long a = 16807;
const long m = 2147483647;
const long q = 127773; /* (m/a) */
const long r = 2836; /* (m%a) */
_rand_r(unsigned int* pseed)
{
const long a = 16807;
const long m = 2147483647;
const long q = 127773; /* (m/a) */
const long r = 2836; /* (m%a) */
_rand_r(unsigned int* pseed)
{
const long a = 16807;
const long m = 2147483647;
const long q = 127773; /* (m/a) */
const long r = 2836; /* (m%a) */
a = random->mean * ( random->mean * (1 - random->mean) / (random->std*random->std) - 1 );
b = (1 - random->mean) * ( random->mean * (1 - random->mean) / (random->std*random->std) - 1 );
a = random->mean * ( random->mean * (1 - random->mean) / (random->std*random->std) - 1 );
b = (1 - random->mean) * ( random->mean * (1 - random->mean) / (random->std*random->std) - 1 );
double mean, double std){
random_data_t random = xbt_new0(s_random_data_t, 1);
double mean, double std){
random_data_t random = xbt_new0(s_random_data_t, 1);
THROW2(arg_error,0,"Invalid mean and standard deviation (%f and %f)",random->mean, random->std);
THROW2(arg_error,0,"Invalid mean and standard deviation (%f and %f)",random->mean, random->std);