|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sam.toolkit.Random.IntegerSetRandomizer
Class for randomizing over fixed integer sets.
This is a randomizer that randomly chooses a permutation on a set of integers.
Note that all n!
permutations on n
integers are equi-probable.
This class implements such a randomly chosen permutation as a standard Enumeration
on those allows integers.
Constructor Summary | |
Random.IntegerSetRandomizer(int length)
Builds a new randomly choosen permutation on a range of integers. |
|
Random.IntegerSetRandomizer(int[] credits)
Builds a new randomly choosen permutation on a range of weighted integers. |
Method Summary | |
boolean |
hasMoreElements()
Wether this enumeration has more elements to enumerate. |
int |
next()
Gets the next integer to enumerate |
java.lang.Object |
nextElement()
Gets the next element to enumerate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Random.IntegerSetRandomizer(int length)
length
- the largest integer: the integer range thus is [0 , length-1]
.public Random.IntegerSetRandomizer(int[] credits)
Method Detail |
public boolean hasMoreElements()
hasMoreElements
in interface java.util.Enumeration
public java.lang.Object nextElement() throws java.util.NoSuchElementException
nextElement
in interface java.util.Enumeration
Integer
containing the next integer
java.util.NoSuchElementException
- if no more such integer is to be enumeratedpublic int next() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if no more such integer is to be enumerated
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |