anthill.util
Class ExtendedRandom
java.lang.Object
|
+--java.util.Random
|
+--anthill.util.ExtendedRandom
- All Implemented Interfaces:
- Serializable
- public class ExtendedRandom
- extends Random
This class extends Random
by adding some utility methods.
These additions include methods for tossing coins with a specified
probability, and to obtain random value with normal distribution
with specified mean and deviation.
- Version:
- $Revision: 1.3 $
- Author:
- Alberto Montresor
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExtendedRandom
public ExtendedRandom()
ExtendedRandom
public ExtendedRandom(long seed)
nextNormal
public int nextNormal(int mean,
double deviation)
nextAbsoluteNormal
public int nextAbsoluteNormal(int mean,
double deviation)
nextNormal
public float nextNormal(float mean,
double deviation)
nextAbsoluteNormal
public float nextAbsoluteNormal(float mean,
double deviation)
nextNormal
public double nextNormal(double mean,
double deviation)
nextAbsoluteNormal
public double nextAbsoluteNormal(double mean,
double deviation)
tossCoin
public boolean tossCoin(float prob)
- Toss a coin returning true or false, with the specified
probability of returning true.
- Parameters:
prob
- The probability of returning true