static struct random_data unsafe_state
=
{
/
*
FPTR
and
RPTR are two pointers into the state info, a front
and
a rear
pointer. These two pointers are always rand_sep places aparts, as they
cycle through the state information. (Yes, this does mean we could get
away with just one pointer, but the code
for
random
is
more efficient
this way). The pointers are left positioned as they would be
from
the call:
initstate(
1
, randtbl,
128
);
(The position of the rear pointer, rptr,
is
really
0
(as explained above
in
the initialization of randtbl) because the state table pointer
is
set
to point to randtbl[
1
] (as explained below).)
*
/
fptr : &randtbl[SEP_3
+
1
],
rptr : &randtbl[
1
],
/
*
The following things are the pointer to the state information table,
the
type
of the current generator, the degree of the current polynomial
being used,
and
the separation between the two pointers.
Note that
for
efficiency of random, we remember the first location of
the state information,
not
the zeroth. Hence it
is
valid to access
state[
-
1
], which
is
used to store the
type
of the R.N.G.
Also, we remember the last location, since this
is
more efficient than
indexing every time to find the address of the last element to see
if
the front
and
rear pointers have wrapped.
*
/
state : &randtbl[
1
],
rand_type : TYPE_3,
rand_deg : DEG_3,
rand_sep : SEP_3,
end_ptr : &randtbl[sizeof (randtbl)
/
sizeof (randtbl[
0
])]
};