|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinf.util.BiasedRandom
public abstract class BiasedRandom
This class represents a source of randomness that, unlike
java.util.Random
, returns random numbers according to a
non-uniform distribution. The random number generators provided by this class
all use Random.nextDouble()
as the underlying source of
randomness. Only EXP10_0
incurs a significant performance
overhead compared to the source.
Field Summary | |
---|---|
static BiasedRandom |
EXP10_0
A zero-biased source of random numbers. |
static BiasedRandom |
LINEAR_0
A zero-biased source of random numbers. |
static BiasedRandom |
POLY2_0
A zero-biased source of random numbers. |
static BiasedRandom |
POLY4_0
A zero-biased source of random numbers. |
static BiasedRandom |
POLY8_0
A zero-biased source of random numbers. |
Constructor Summary | |
---|---|
BiasedRandom()
|
Method Summary | |
---|---|
abstract double |
nextDouble()
This function returns a biased random double from the range 0.0d (inclusive) to 1.0d (exclusive). |
int |
nextInt(int n)
This function returns a biased random double int 0 and n-1 (both inclusive). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final BiasedRandom LINEAR_0
A zero-biased source of random numbers. The numbers are biased towards 0 according a linear distribution.
public static final BiasedRandom POLY2_0
A zero-biased source of random numbers. The numbers are biased towards 0 according a polynomial (degree 2) distribution.
public static final BiasedRandom POLY4_0
A zero-biased source of random numbers. The numbers are biased towards 0 according a polynomial (degree 4) distribution.
public static final BiasedRandom POLY8_0
A zero-biased source of random numbers. The numbers are biased towards 0 according a polynomial (degree 8) distribution.
public static final BiasedRandom EXP10_0
A zero-biased source of random numbers. The numbers are biased towards 0
according a exponential distribution. Note: This random number generator
is significantly slower than the polynomial ones and tends to be less
biased than for example POLY8_0
.
Constructor Detail |
---|
public BiasedRandom()
Method Detail |
---|
public abstract double nextDouble()
This function returns a biased random double from the range 0.0d (inclusive) to 1.0d (exclusive).
public int nextInt(int n)
This function returns a biased random double int 0 and n-1 (both inclusive).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |