weiss.util
Class Random

java.lang.Object
  extended by weiss.util.Random

public class Random
extends java.lang.Object


Constructor Summary
Random()
           
Random(int initialValue)
           
Random(long initialValue)
           
 
Method Summary
static void main(java.lang.String[] args)
           
 double nextDouble()
          Return a pseudorandom double in the range [0..1) and change the internal state.
 int nextInt()
          Return a pseudorandom int, and change the internal state.
 int nextInt(int high)
          Return a pseudorandom int in range [0..high), and change the internal state.
 int nextInt(int low, int high)
          Return an int in the closed range [low,high], and change the internal state.
 long nextLong()
          Return a 64-bit long, and change the internal state.
 double nextNegExp(double expectedValue)
          Return a double using a negative exponential distribution, and change the internal state.
 int nextPoisson(double expectedValue)
          Return an int using a Poisson distribution, and change the internal state.
static
<AnyType> void
permute(AnyType[] a)
          Randomly rearrange an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Random

public Random()

Random

public Random(int initialValue)

Random

public Random(long initialValue)
Method Detail

nextInt

public int nextInt()
Return a pseudorandom int, and change the internal state.

Returns:
the pseudorandom int.

nextInt

public int nextInt(int high)
Return a pseudorandom int in range [0..high), and change the internal state.

Returns:
the pseudorandom int.

nextDouble

public double nextDouble()
Return a pseudorandom double in the range [0..1) and change the internal state.

Returns:
the pseudorandom double.

nextInt

public int nextInt(int low,
                   int high)
Return an int in the closed range [low,high], and change the internal state.

Parameters:
low - the minimum value returned.
high - the maximum value returned.
Returns:
the pseudorandom int.

nextLong

public long nextLong()
Return a 64-bit long, and change the internal state. Note that all longs can be generated.

Returns:
the pseudorandom long.

nextPoisson

public int nextPoisson(double expectedValue)
Return an int using a Poisson distribution, and change the internal state.

Parameters:
expectedValue - the mean of the distribution.
Returns:
the pseudorandom int.

nextNegExp

public double nextNegExp(double expectedValue)
Return a double using a negative exponential distribution, and change the internal state.

Parameters:
expectedValue - the mean of the distribution.
Returns:
the pseudorandom double.

permute

public static final <AnyType> void permute(AnyType[] a)
Randomly rearrange an array. The random numbers used depend on the time and day.

Parameters:
a - the array.

main

public static void main(java.lang.String[] args)