|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softsynth.jmsl.util.HailstoneSequence
public class HailstoneSequence
Generate "Hailstone Sequence" based on an article in
Scientific American FIXME - find reference.
If the previous value is odd, then n= p*3 - 5;
If the previous value is even, then n= p/2 + 1;
Constructor Summary | |
---|---|
HailstoneSequence()
|
Method Summary | |
---|---|
int |
getNext()
|
int |
getOffset()
|
int |
getSeed()
|
int |
next()
Return next value in sequence, then generate new value. |
void |
randomize()
Set seed from system time. |
void |
reset()
Reset sequence generator so that it will restart at beginning. |
void |
setNext(int next)
Set next value in sequence. |
void |
setOffset(int offset)
|
void |
setSeed(int seed)
Set sequence seed. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HailstoneSequence()
Method Detail |
---|
public int next()
next
in interface SequenceGenerator
public int getNext()
getNext
in interface SequenceGenerator
public void setNext(int next)
setNext
in interface SequenceGenerator
public void randomize()
randomize
in interface SequenceGenerator
public void setSeed(int seed)
setSeed
in interface SequenceGenerator
public int getSeed()
getSeed
in interface SequenceGenerator
public void reset()
reset
in interface SequenceGenerator
public int getOffset()
public void setOffset(int offset)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |