Package jebl.math
Class Random
- java.lang.Object
-
- jebl.math.Random
-
public class Random extends java.lang.ObjectRandom number generation.- Version:
- $Id: Random.java 370 2006-06-29 18:57:56Z rambaut $
- Author:
- Matthew Goode, Alexei Drummond
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double[]getNormalized(double[] array)static doublegetTotal(double[] array)static doublegetTotal(double[] array, int start, int end)static booleannextBoolean()Access a default instance of this class, access is synchronizedstatic bytenextByte()Access a default instance of this class, access is synchronizedstatic voidnextBytes(byte[] bs)Access a default instance of this class, access is synchronizedstatic charnextChar()Access a default instance of this class, access is synchronizedstatic doublenextDouble()Access a default instance of this class, access is synchronizedstatic floatnextFloat()Access a default instance of this class, access is synchronizedstatic doublenextGaussian()Access a default instance of this class, access is synchronizedstatic intnextInt()Access a default instance of this class, access is synchronizedstatic intnextInt(int n)Access a default instance of this class, access is synchronizedstatic longnextLong()Access a default instance of this class, access is synchronizedstatic shortnextShort()Access a default instance of this class, access is synchronizedstatic intrandomChoice(double[] cf)static voidsetSeed(long seed)Access a default instance of this class, access is synchronizedstatic voidshuffle(int[] array)Shuffles an array.static voidshuffle(int[] array, int numberOfShuffles)Shuffles an array.static int[]shuffled(int l)Returns an array of shuffled indices of length l.
-
-
-
Method Detail
-
randomChoice
public static int randomChoice(double[] cf)
-
getNormalized
public static double[] getNormalized(double[] array)
- Returns:
- a new double array where all the values sum to 1. Relative ratios are preserved.
-
getTotal
public static double getTotal(double[] array, int start, int end)- Parameters:
end- the index of the element after the last one to be included- Returns:
- the total of a the values in a range of an array
-
getTotal
public static double getTotal(double[] array)
- Returns:
- the total of the values in an array
-
setSeed
public static void setSeed(long seed)
Access a default instance of this class, access is synchronized
-
nextByte
public static byte nextByte()
Access a default instance of this class, access is synchronized
-
nextBoolean
public static boolean nextBoolean()
Access a default instance of this class, access is synchronized
-
nextBytes
public static void nextBytes(byte[] bs)
Access a default instance of this class, access is synchronized
-
nextChar
public static char nextChar()
Access a default instance of this class, access is synchronized
-
nextGaussian
public static double nextGaussian()
Access a default instance of this class, access is synchronized
-
nextDouble
public static double nextDouble()
Access a default instance of this class, access is synchronized
-
nextFloat
public static float nextFloat()
Access a default instance of this class, access is synchronized
-
nextLong
public static long nextLong()
Access a default instance of this class, access is synchronized
-
nextShort
public static short nextShort()
Access a default instance of this class, access is synchronized
-
nextInt
public static int nextInt()
Access a default instance of this class, access is synchronized
-
nextInt
public static int nextInt(int n)
Access a default instance of this class, access is synchronized
-
shuffle
public static void shuffle(int[] array)
Shuffles an array.
-
shuffle
public static void shuffle(int[] array, int numberOfShuffles)Shuffles an array. Shuffles numberOfShuffles times
-
shuffled
public static int[] shuffled(int l)
Returns an array of shuffled indices of length l.- Parameters:
l- length of the array required.
-
-