Class N08_Part2_DataStructureAccess.RandomIndex

java.lang.Object
  extended by N08_Part2_DataStructureAccess.RandomIndex
Enclosing class:
N08_Part2_DataStructureAccess

protected static class N08_Part2_DataStructureAccess.RandomIndex
extends Object

Via the next method, returns all the valid indices of N08_Part2_DataStructureAccess.integers in seemingly random order.

The current implementation internally uses a maximal length 32-bit linear feedback shift register (LFSR) to continuously cycle thru all the valid indices of N08_Part2_DataStructureAccess.integers (except 0: LFSR's cannot handle it without getting stuck at it forever). The code here is an adaptation of the class Lfsr.


Field Summary
protected static int integersMask
           
protected static int mask
           
protected static int register
           
protected static int taps
           
 
Constructor Summary
protected N08_Part2_DataStructureAccess.RandomIndex()
           
 
Method Summary
protected static void init(int m)
           
protected static int next()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

register

protected static int register

mask

protected static int mask

taps

protected static int taps

integersMask

protected static int integersMask
Constructor Detail

N08_Part2_DataStructureAccess.RandomIndex

protected N08_Part2_DataStructureAccess.RandomIndex()
Method Detail

init

protected static void init(int m)
                    throws IllegalArgumentException
Throws:
IllegalArgumentException

next

protected static int next()