|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Random | +--y.util.YRandom
Generates pseudorandom numbers and the such.
Constructor Summary | |
YRandom()
Creates a new instance of this class. |
|
YRandom(long seed)
Creates a new instance of this class with a given initial random seed. |
Method Summary | |
boolean[] |
getBoolArray(int n,
int trueCount)
Returns an array of n randomly chosen boolean values
of which trueCount of them are true .
|
int[] |
getIntArray(int bucketCount,
int ballCount)
Returns an int array of length bucketCount |
int[] |
getUniqueArray(int n,
int min,
int max)
Returns an array of n unique random integers that
lie within the range min (inclusive) and
max (exclusive). |
double |
nextDouble(double minValue,
double maxValue)
Returns a double with a random value between minValue
(inclusive) and maxValue (exklusive).
|
int |
nextInt(int n)
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. |
int |
nextInt(int minValue,
int maxValue)
Returns an int with a random value between minValue
(inclusive) and maxValue (exclusive).
|
void |
permutate(Object[] a)
Permutates the positions of the elements within the given array. |
Methods inherited from class java.util.Random |
next, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextLong, setSeed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public YRandom()
public YRandom(long seed)
Method Detail |
public int nextInt(int n)
nextInt
in class Random
public int[] getUniqueArray(int n, int min, int max)
n
unique random integers that
lie within the range min
(inclusive) and
max
(exclusive). If max - min < n
then null
is returned.
public boolean[] getBoolArray(int n, int trueCount)
n
randomly chosen boolean values
of which trueCount
of them are true
.
If the requested numbers of true values is bigger than the number
of requested boolean values, an Exception is raised.
public int[] getIntArray(int bucketCount, int ballCount)
bucketCount for
which the values of all fields are non-negative and sum up
to ballCount
. The values are put
in the array randomly.
public double nextDouble(double minValue, double maxValue)
minValue
(inclusive) and maxValue
(exklusive).
Precondition: maxValue > minValue
public int nextInt(int minValue, int maxValue)
minValue
(inclusive) and maxValue
(exclusive).
Precondition: maxValue > minValue
public void permutate(Object[] a)
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |