StdRandom

Modifier and Type
Method and Description

static boolean
bernoulli

Returns a random boolean from a Bernoulli distribution with success
probability 1/2.

static boolean
bernoulli

Returns a random boolean from a Bernoulli distribution with success
probability p.

static double
cauchy

Returns a random real number from the Cauchy distribution.

static int
discrete

Returns a random integer from the specified discrete distribution.

static int
discrete

Returns a random integer from the specified discrete distribution.

static double
exp

Returns a random real number from an exponential distribution
with rate λ.

static double
gaussian

Returns a random real number from a standard Gaussian distribution.

static double
gaussian

Returns a random real number from a Gaussian distribution with mean μ
and standard deviation σ.

static int
geometric

Returns a random integer from a geometric distribution with success
probability p.

static long
getSeed

Returns the seed of the pseudo-random number generator.

static void
mainString[] args)

Unit tests the methods in this class.

static double
pareto

Returns a random real number from the standard Pareto distribution.

static double
pareto

Returns a random real number from a Pareto distribution with
shape parameter α.

static int[]
permutation

Returns a uniformly random permutation of n elements.

static int[]
permutation

Returns a uniformly random permutation of k of n elements.

static int
poisson

Returns a random integer from a Poisson distribution with mean λ.

static double
random

Deprecated.

 

static void
setSeed

Sets the seed of the pseudo-random number generator.

static void
shuffle

Rearranges the elements of the specified array in uniformly random order.

static void
shuffle

Rearranges the elements of the specified array in uniformly random order.

static void
shuffle

Rearranges the elements of the specified subarray in uniformly random order.

static void
shuffle

Rearranges the elements of the specified array in uniformly random order.

static void
shuffle

Rearranges the elements of the specified subarray in uniformly random order.

static void
shuffleObject[] a)

Rearranges the elements of the specified array in uniformly random order.

static void
shuffleObject[] a,
int lo,
int hi)

Rearranges the elements of the specified subarray in uniformly random order.

static double
uniform

Deprecated.

 

static double
uniform

Deprecated.

 

static int
uniform

Deprecated.

 

static int
uniform

Deprecated.

 

static long
uniform

Deprecated.

 

static double
uniformDouble

Returns a random real number uniformly in [0, 1).

static double
uniformDouble

Returns a random real number uniformly in [a, b).

static int
uniformInt

Returns a random integer uniformly in [0, n).

static int
uniformInt

Returns a random integer uniformly in [a, b).

static long
uniformLong

Returns a random long integer uniformly in [0, n).