56 return (bs->
t < bs->
N) && (bs->
m < bs->
n);
63 int k = bs->
n - bs->
m;
98 p = 1.0 - (double) k / (
double)
K;
106 p *= 1.0 - (double) k / (
double)
K;
157 quot = (t - (double) n) / t;
163 quot *= (t - (double) n) / t;
170 double term = t - (double) n + 1;
189 tmp = (t + 1) / term;
190 lhs = exp(log(((U * tmp * tmp) * (term + S)) / (t + X)) / n);
191 rhs = (((t + X) / (term + S)) * term) / t;
198 y = (((U * (t + 1)) / term) * (t + S + 1)) / (t + X);
202 numer_lim = term +
S;
206 denom = t - (double) n + S;
209 for (numer = t + S; numer >= numer_lim; numer -= 1)
215 if (exp(log(y) / n) <= (t + X) / t)
231 randstate[0] = 0x330e;
232 randstate[1] = (
unsigned short) seed;
233 randstate[2] = (
unsigned short) (seed >> 16);
246 }
while (res == 0.0);
bool BlockSampler_HasMore(BlockSampler bs)
void sampler_random_init_state(long seed, SamplerRandomState randstate)
BlockNumber BlockSampler_Next(BlockSampler bs)
double sampler_random_fract(SamplerRandomState randstate)
void reservoir_init_selection_state(ReservoirState rs, int n)
unsigned short SamplerRandomState[3]
void BlockSampler_Init(BlockSampler bs, BlockNumber nblocks, int samplesize, long randseed)
static ReservoirStateData oldrs
double anl_random_fract(void)
double pg_erand48(unsigned short xseed[3])
#define Assert(condition)
double anl_get_next_S(double t, int n, double *stateptr)
double anl_init_selection_state(int n)
SamplerRandomState randstate
double reservoir_get_next_S(ReservoirState rs, double t, int n)
SamplerRandomState randstate