ProGAL.math
Class Randomization

java.lang.Object
  extended by ProGAL.math.Randomization

public class Randomization
extends java.lang.Object

A wrapper for static randomization functions.

Author:
rfonseca

Constructor Summary
Randomization()
           
 
Method Summary
static java.util.Random getGenerator()
           
static double randBetween(double d1, double d2)
          Return a uniform random double between (including) d1 and (not including) d2
static int randBetween(int i1, int i2)
          Return a uniform random number between (including) i1 and (not including) i2.
static void randomizeInPlace(int[] as)
          Randomize an array.
static int[] randomPermutation(int max)
          Generate a random permutation of integers between (including) 0 and (not including) max
static void seed(long s)
          Seeds the random generater used by this class.
static java.lang.Object[] shuffle(java.lang.Object[] arr)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Randomization

public Randomization()
Method Detail

getGenerator

public static java.util.Random getGenerator()

randBetween

public static int randBetween(int i1,
                              int i2)
Return a uniform random number between (including) i1 and (not including) i2.

Parameters:
i1 - lower bound of random number
i2 - upper bound of random number

randBetween

public static double randBetween(double d1,
                                 double d2)
Return a uniform random double between (including) d1 and (not including) d2

Parameters:
d1 - lower bound of random number
d2 - upper bound of random number

randomPermutation

public static int[] randomPermutation(int max)
Generate a random permutation of integers between (including) 0 and (not including) max

Parameters:
max - the length of the permutation

randomizeInPlace

public static void randomizeInPlace(int[] as)
Randomize an array.

Parameters:
as - the array to be randomized

seed

public static void seed(long s)
Seeds the random generater used by this class.

Parameters:
s - seed

shuffle

public static java.lang.Object[] shuffle(java.lang.Object[] arr)