|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnars.storage.Distributor
class Distributor
A pseudo-random number generator, used in Bag.
Field Summary | |
---|---|
private int |
capacity
Capacity of the array |
private int[] |
order
Shuffled sequence of index numbers |
Constructor Summary | |
---|---|
Distributor(int range)
For any number N < range, there is N+1 copies of it in the array, distributed as evenly as possible |
Method Summary | |
---|---|
int |
next(int index)
Advance the index |
int |
pick(int index)
Get the next number according to the given index |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int[] order
private int capacity
Constructor Detail |
---|
public Distributor(int range)
range
- Range of valid numbersMethod Detail |
---|
public int pick(int index)
index
- The current index
public int next(int index)
index
- The current index
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |