A random number generator circuit includes a primary circuit configured to generate
a value within a first range and a secondary circuit configured to generate a value
within a second range. A detector circuit detects whether or not the value from
the primary circuit is within the desired output range for the random number generator
circuit, and selects either the value from the primary circuit or the value from
the secondary circuit in response. The second range is the desired output range
and the first range encompasses the second range. In one embodiment, the primary
circuit has complex harmonics but may generate values outside the desired range.
The secondary circuit may have less complex harmonics, but may generate values
only within the desired range. In one implementation, the random number generator
circuit is used to generate a replacement way for a cache.