evolve4src/src/evolve_simulator/random.cpp
long sim_random(EVOLVE_RANDOM *er)
{
	register long i;
	register int f, r;

	f = er->fidx;
	r = er->ridx;

	er->state[f] += er->state[r];
	i = (er->state[f] >> 1) & 0x7fffffff;	/* chucking least random bit */

	if( ++f >= EVOLVE_DEG4 ) {
		f = 0;
		r += 1;
	} else if( ++r >= EVOLVE_DEG4 ) {
		r = 0;
	}

	er->fidx = f;
	er->ridx = r;

	return i;
}
/*
 * random:
 *
 * The basic operation is to add the number at the rear index
 * into the one at the front index.  Then both indexes are advanced to
 * the next location cyclically in the table.  The value returned is the sum
 * generated, reduced to 31 bits by throwing away the "least random" low bit.
 *
 * Note: the code takes advantage of the fact that both the front and
 * rear indexes can't wrap on the same call by not testing the rear
 * index if the front one has wrapped.
 *
 * Returns a 31-bit random number.
 */
The basic operation is to add the number at the rear index
into the one at the front index.  Then both indexes are advanced to
the next location cyclically in the table.  The value returned is the sum
generated, reduced to 31 bits by throwing away the "least random" low bit.

the code takes advantage of the fact that both the front and
rear indexes can't wrap on the same call by not testing the rear
index if the front one has wrapped.

Returns a 31-bit random number.
The basic operation is to add the number at the rear index into the one at the front index . Then both indexes are advanced to the next location cyclically in the table . The value returned is the sum generated reduced to 31 bits by throwing away the " least random " low bit . the code takes advantage of the fact that both the front and rear indexes can ' t wrap on the same call by not testing the rear index if the front one has wrapped . Returns a 31 - bit random number .
long sim_random(EVOLVE_RANDOM *er)
{
	register long i;
	register int f, r;
	f = er->fidx;
	r = er->ridx;
	er->state[f] += er->state[r];
	i = (er->state[f] >> 1) & 0x7fffffff;	
	if( ++f >= EVOLVE_DEG4 ) {
		f = 0;
		r += 1;
	} else if( ++r >= EVOLVE_DEG4 ) {
		r = 0;
	}
	er->fidx = f;
	er->ridx = r;
	return i;
}
long sim_random ( EVOLVE_RANDOM * er ) { register long i ; register int f , r ; f = er -> fidx ; r = er -> ridx ; er -> state [ f ] += er -> state [ r ] ; i = ( er -> state [ f ] >> 1 ) & 0x7fffffff ; if ( ++ f >= EVOLVE_DEG4 ) { f = 0 ; r += 1 ; } else if ( ++ r >= EVOLVE_DEG4 ) { r = 0 ; } er -> fidx = f ; er -> ridx = r ; return i ; }
random:
 The basic operation is to add the number at the rear index
 into the one at the front index.
random : The basic operation is to add the number at the rear index into the one at the front index .
/* chucking least random bit */