|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KRandomSequence
public class KRandomSequence
A class to create a pseudo-random sequence Given a seed number, this class will produce a sequence of pseudo-random numbers. This would typically be used in applications like games. In general, you should instantiate a KRandomSequence object and pass along your seed number in the constructor. From then on, simply call getDouble() or getLong() to obtain the next number in the sequence.
Constructor Summary | |
---|---|
|
KRandomSequence()
|
protected |
KRandomSequence(java.lang.Class dummy)
|
|
KRandomSequence(KRandomSequence a)
Copy constructor |
|
KRandomSequence(long lngSeed)
Creates a pseudo-random sequence based on the seed lngSeed. |
Method Summary | |
---|---|
void |
dispose()
Delete the wrapped C++ instance ahead of finalize() |
protected void |
finalize()
Deletes the wrapped C++ instance |
boolean |
getBool()
Get a booleanean from the pseudo-random sequence. |
double |
getDouble()
Get the next number from the pseudo-random sequence. |
long |
getLong(long max)
Get the next number from the pseudo-random sequence. |
boolean |
isDisposed()
Has the wrapped C++ instance been deleted? |
void |
modulate(int i)
Modulate the random sequence. |
void |
setSeed()
|
void |
setSeed(long lngSeed)
Restart the sequence based on lngSeed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected KRandomSequence(java.lang.Class dummy)
public KRandomSequence(long lngSeed)
lngSeed
- Seed to initialize the sequence with.
If lngSeed is 0, the sequence is initialized with a value from
KApplication.random().public KRandomSequence()
public KRandomSequence(KRandomSequence a)
Method Detail |
---|
public void setSeed(long lngSeed)
lngSeed
- Seed to initialize the sequence with.
If lngSeed is 0, the sequence is initialized with a value from
KApplication.random().public void setSeed()
public double getDouble()
public long getLong(long max)
public boolean getBool()
public void modulate(int i)
i
- the sequence identifiedprotected void finalize() throws java.lang.InternalError
finalize
in class java.lang.Object
java.lang.InternalError
public void dispose()
public boolean isDisposed()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |