StdRandom Class |
Namespace: Algs4Net
public sealed class StdRandom
The StdRandom type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | Seed |
The seed of the pseudorandom number generator.
Using the same seed enables you to produce the same sequence of "random"
number for each execution of the program.
Ordinarily, you should set the seed at most once per program. |
Name | Description | |
---|---|---|
![]() ![]() | Bernoulli |
Returns a random boolean from a Bernoulli distribution with success
probability 1/2. |
![]() ![]() | Bernoulli(Double) |
Returns a random boolean from a Bernoulli distribution with success
probability P. |
![]() ![]() | Cauchy |
Returns a random real number from the Cauchy distribution. |
![]() ![]() | Discrete(Double) |
Returns a random integer from the specified discrete distribution. |
![]() ![]() | Discrete(Int32) |
Returns a random integer from the specified discrete distribution. |
![]() ![]() | Exp |
Returns a random real number from an exponential distribution
with rate lambda (λ). |
![]() ![]() | Gaussian |
Returns a random real number from a standard Gaussian distribution. |
![]() ![]() | Gaussian(Double, Double) |
Returns a random real number from a Gaussian distribution with mean mu (μ)
and standard deviation sigma (σ). |
![]() ![]() | Geometric |
Returns a random integer from a geometric distribution with success
probability P. |
![]() ![]() | MainTest | Unit test the StdRandom methods |
![]() ![]() | Pareto |
Returns a random real number from the standard Pareto distribution. |
![]() ![]() | Pareto(Double) |
Returns a random real number from a Pareto distribution with
shape parameter alpha (α). |
![]() ![]() | Poisson |
Returns a random integer from a Poisson distribution with mean lambda (λ). |
![]() ![]() | Random |
Returns a random real number uniformly in [0, 1). |
![]() ![]() | Shuffle(Double) |
Rearranges the elements of the specified array in uniformly random order. |
![]() ![]() | Shuffle(Int32) |
Rearranges the elements of the specified array in uniformly random order. |
![]() ![]() | Shuffle(Object) |
Rearranges the elements of the specified array in uniformly random order. |
![]() ![]() | Shuffle(Double, Int32, Int32) |
Rearranges the elements of the specified subarray in uniformly random order. |
![]() ![]() | Shuffle(Int32, Int32, Int32) |
Rearranges the elements of the specified subarray in uniformly random order. |
![]() ![]() | Shuffle(Object, Int32, Int32) |
Rearranges the elements of the specified subarray in uniformly random order. |
![]() ![]() | Uniform |
Returns a random real number uniformly in [0, 1). |
![]() ![]() | Uniform(Int32) |
Returns a random integer uniformly in [0, n). |
![]() ![]() | Uniform(Double, Double) |
Returns a random real number uniformly in [a, b). |
![]() ![]() | Uniform(Int32, Int32) |
Returns a random integer uniformly in [a, b). |
This class is a C# port from the original Java class StdRandom implementation by Robert Sedgewick and Kevin Wayne.