|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteos.util.StdRandom
public class StdRandom
Modified by zhihongx in 2010 to allow setting the seed for the pseudorandom number generator
Constructor Summary | |
---|---|
StdRandom()
|
Method Summary | |
---|---|
static boolean |
bernoulli()
Return a boolean, which is true with probability .5, and false otherwise. |
static boolean |
bernoulli(double p)
Return a boolean, which is true with probability p, and false otherwise. |
static double |
cauchy()
Return a real number with a Cauchy distribution. |
static int |
discrete(double[] a)
Return a number from a discrete distribution: i with probability a[i]. |
static double |
exp(double lambda)
Return a real number from an exponential distribution with rate lambda. |
static double |
gaussian()
Return a real number with a standard Gaussian distribution. |
static double |
gaussian(double mean,
double stddev)
Return a real number from a gaussian distribution with given mean and stddev |
static int |
geometric(double p)
Return an integer with a geometric distribution with mean 1/p. |
static java.util.Random |
getRandom()
Return a Random object |
static double |
pareto(double alpha)
Return a real number with a Pareto distribution with parameter alpha. |
static int |
poisson(double lambda)
Return an integer with a Poisson distribution with mean lambda. |
static void |
setSeed(long seed)
Set the seed for the pseudorandom number generator |
static void |
shuffle(double[] a)
Rearrange the elements of a double array in random order. |
static void |
shuffle(double[] a,
int lo,
int hi)
Rearrange the elements of the subarray a[lo..hi] in random order. |
static void |
shuffle(int[] a)
Rearrange the elements of an int array in random order. |
static void |
shuffle(int[] a,
int lo,
int hi)
Rearrange the elements of the subarray a[lo..hi] in random order. |
static void |
shuffle(java.lang.Object[] a)
Rearrange the elements of an array in random order. |
static void |
shuffle(java.lang.Object[] a,
int lo,
int hi)
Rearrange the elements of the subarray a[lo..hi] in random order. |
static double |
uniform()
Return real number uniformly in [0, 1). |
static double |
uniform(double a,
double b)
Return real number uniformly in [a, b). |
static int |
uniform(int N)
Return an integer uniformly between 0 and N-1. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StdRandom()
Method Detail |
---|
public static void setSeed(long seed)
seed
- public static java.util.Random getRandom()
public static double uniform()
public static double uniform(double a, double b)
public static int uniform(int N)
public static boolean bernoulli(double p)
public static boolean bernoulli()
public static double gaussian()
public static double gaussian(double mean, double stddev)
public static int geometric(double p)
public static int poisson(double lambda)
public static double pareto(double alpha)
public static double cauchy()
public static int discrete(double[] a)
public static double exp(double lambda)
public static void shuffle(java.lang.Object[] a)
public static void shuffle(double[] a)
public static void shuffle(int[] a)
public static void shuffle(java.lang.Object[] a, int lo, int hi)
public static void shuffle(double[] a, int lo, int hi)
public static void shuffle(int[] a, int lo, int hi)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |