ukacgla_KMap
Class KMap_Random
java.lang.Object
|
+--ukacgla_KMap.KMap_Random
- public abstract class KMap_Random
- extends java.lang.Object
Provides Random numbers generator to fill the k map.
The random numbers generated are stored in an array.
Constructor Summary |
KMap_Random(int n)
Creates a new Random number generator, creates an array of specified size and generates
required number of numbers (either 0 or 1) to fill the array. |
Method Summary |
void |
genArray()
Generate required number of numbers (either 0 or 1) and store these in array. |
int |
genSingle(int n)
Generates a random number between 0(inclusive) and n(exclusive)
If n is zero, will throw new IllegalArgumentException("n must be positive"); |
int |
getRandom(int n)
Returns the random number stored at the specified index. |
java.util.Vector |
randomise(java.util.Vector original)
Will copy the elements of a vector into a new Vector, then return the new vector. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KMap_Random
public KMap_Random(int n)
- Creates a new Random number generator, creates an array of specified size and generates
required number of numbers (either 0 or 1) to fill the array.
genArray
public void genArray()
- Generate required number of numbers (either 0 or 1) and store these in array.
genSingle
public int genSingle(int n)
- Generates a random number between 0(inclusive) and n(exclusive)
If n is zero, will throw new IllegalArgumentException("n must be positive");
getRandom
public int getRandom(int n)
- Returns the random number stored at the specified index.
randomise
public java.util.Vector randomise(java.util.Vector original)
- Will copy the elements of a vector into a new Vector, then return the new vector.
The new Vector has the same number of elements as the original, but in a different order