Exemplo n.º 1
0
static int flip_cycle(RNG *rand)
{     /* this is an auxiliary routine to do 55 more steps of the basic
         recurrence, at high speed, and to reset fptr */
      int *ii, *jj;
      for (ii = &A[1], jj = &A[32]; jj <= &A[55]; ii++, jj++)
         *ii = mod_diff(*ii, *jj);
      for (jj = &A[1]; ii <= &A[55]; ii++, jj++)
         *ii = mod_diff(*ii, *jj);
      fptr = &A[54];
      return A[55];
}
Exemplo n.º 2
0
Arquivo: lee.c Projeto: walafc0/soclib
int gb_flip_cycle()
{
register int*ii,*jj;

   for(ii= &A[1],jj= &A[32];jj<=&A[55];ii++,jj++)
      *ii= mod_diff(*ii,*jj);
   for(jj= &A[1];ii<=&A[55];ii++,jj++)
      *ii= mod_diff(*ii,*jj);
   gb_fptr= &A[54];
   return A[55];
}
Exemplo n.º 3
0
void rng_init_rand(RNG *rand, int seed)
{     int i;
      int prev = seed, next = 1;
      seed = prev = mod_diff(prev, 0);
      A[55] = prev;
      for (i = 21; i; i = (i + 21) % 55)
      {  A[i] = next;
         next = mod_diff(prev, next);
         if (seed & 1)
            seed = 0x40000000 + (seed >> 1);
         else
            seed >>= 1;
         next = mod_diff(next, seed);
         prev = A[i];
      }
Exemplo n.º 4
0
void gb_init_rand(long seed)
{
register long i;
register long prev= seed,next= 1;

   seed= prev= mod_diff(prev,0);
   A[55]= prev;
   for(i= 21;i;i= (i+21)%55){
      A[i]= next;

      next= mod_diff(prev,next);
      if(seed&1)seed= 0x40000000+(seed>>1);
      else seed>>= 1;
      next= mod_diff(next,seed);
      prev= A[i];
   }