core/rand-clcg4.cpp
double
rng_gen_reverse_val(tw_rng_stream * g)
{
  long long *b = rng->b;
  int32_t *m = rng->m;
  int32_t s;
  double u;

  g->count--;

  u = 0.0;

  if(b[0] == 0)
    tw_error(TW_LOC, "b values not calculated \n");

  s = g->Cg[0];
  s =(b[0] * s) % m[0];
  g->Cg[0] = s;
  u = u + 4.65661287524579692e-10 * s;

  s = g->Cg[1];
  s =(b[1] * s) % m[1];
  g->Cg[1] = s;
  u = u - 4.65661310075985993e-10 * s;
  if(u < 0)
    u = u + 1.0;

  s = g->Cg[2];
  s =(b[2] * s) % m[2];
  g->Cg[2] = s;
  u = u + 4.65661336096842131e-10 * s;
  if(u >= 1.0)
    u = u - 1.0;

  s = g->Cg[3];
  s =(b[3] * s) % m[3];
  g->Cg[3] = s;
  u = u - 4.65661357780891134e-10 * s;
  if(u < 0)
    u = u + 1.0;

  return u;
}
/*
 * rng_gen_reverse_val
 *
 * computes the reverse sequence, however does not 
 * return the uniform value computed as a performance 
 * optimization -- Chris Carothers 5/15/98            
 */
rng_gen_reverse_val
computes the reverse sequence, however does not
return the uniform value computed as a performance
optimization -- Chris Carothers 5/15/98
rng_gen_reverse_val computes the reverse sequence however does not return the uniform value computed as a performance optimization -- Chris Carothers 5 / 15 / 98
double
rng_gen_reverse_val(tw_rng_stream * g)
{
  long long *b = rng->b;
  int32_t *m = rng->m;
  int32_t s;
  double u;
  g->count--;
  u = 0.0;
  if(b[0] == 0)
    tw_error(TW_LOC, "b values not calculated \n");
  s = g->Cg[0];
  s =(b[0] * s) % m[0];
  g->Cg[0] = s;
  u = u + 4.65661287524579692e-10 * s;
  s = g->Cg[1];
  s =(b[1] * s) % m[1];
  g->Cg[1] = s;
  u = u - 4.65661310075985993e-10 * s;
  if(u < 0)
    u = u + 1.0;
  s = g->Cg[2];
  s =(b[2] * s) % m[2];
  g->Cg[2] = s;
  u = u + 4.65661336096842131e-10 * s;
  if(u >= 1.0)
    u = u - 1.0;
  s = g->Cg[3];
  s =(b[3] * s) % m[3];
  g->Cg[3] = s;
  u = u - 4.65661357780891134e-10 * s;
  if(u < 0)
    u = u + 1.0;
  return u;
}
double rng_gen_reverse_val ( tw_rng_stream * g ) { long long * b = rng -> b ; int32_t * m = rng -> m ; int32_t s ; double u ; g -> count -- ; u = 0.0 ; if ( b [ 0 ] == 0 ) tw_error ( TW_LOC , " \n " ) ; s = g -> Cg [ 0 ] ; s = ( b [ 0 ] * s ) % m [ 0 ] ; g -> Cg [ 0 ] = s ; u = u + 4.65661287524579692e-10 * s ; s = g -> Cg [ 1 ] ; s = ( b [ 1 ] * s ) % m [ 1 ] ; g -> Cg [ 1 ] = s ; u = u - 4.65661310075985993e-10 * s ; if ( u < 0 ) u = u + 1.0 ; s = g -> Cg [ 2 ] ; s = ( b [ 2 ] * s ) % m [ 2 ] ; g -> Cg [ 2 ] = s ; u = u + 4.65661336096842131e-10 * s ; if ( u >= 1.0 ) u = u - 1.0 ; s = g -> Cg [ 3 ] ; s = ( b [ 3 ] * s ) % m [ 3 ] ; g -> Cg [ 3 ] = s ; u = u - 4.65661357780891134e-10 * s ; if ( u < 0 ) u = u + 1.0 ; return u ; }
rng_gen_reverse_val
 computes the reverse sequence, however does not
 return the uniform value computed as a performance
 optimization -- Chris Carothers 5/15/98
rng_gen_reverse_val computes the reverse sequence however does not return the uniform value computed as a performance optimization -- Chris Carothers 5 / 15 / 98