|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
RandomDataGenerator
directly
public interface RandomData
Random data generation utilities.
Method Summary | |
---|---|
double |
nextExponential(double mean)
Deprecated. Generates a random value from the exponential distribution with specified mean. |
double |
nextGaussian(double mu,
double sigma)
Deprecated. Generates a random value from the Normal (or Gaussian) distribution with specified mean and standard deviation. |
String |
nextHexString(int len)
Deprecated. Generates a random string of hex characters of length len . |
int |
nextInt(int lower,
int upper)
Deprecated. Generates a uniformly distributed random integer between lower
and upper (endpoints included). |
long |
nextLong(long lower,
long upper)
Deprecated. Generates a uniformly distributed random long integer between lower and upper (endpoints included). |
int[] |
nextPermutation(int n,
int k)
Deprecated. Generates an integer array of length k whose entries are selected
randomly, without repetition, from the integers 0, ..., n - 1
(inclusive). |
long |
nextPoisson(double mean)
Deprecated. Generates a random value from the Poisson distribution with the given mean. |
Object[] |
nextSample(Collection<?> c,
int k)
Deprecated. Returns an array of k objects selected randomly from the
Collection c . |
String |
nextSecureHexString(int len)
Deprecated. Generates a random string of hex characters from a secure random sequence. |
int |
nextSecureInt(int lower,
int upper)
Deprecated. Generates a uniformly distributed random integer between lower
and upper (endpoints included) from a secure random sequence. |
long |
nextSecureLong(long lower,
long upper)
Deprecated. Generates a uniformly distributed random long integer between lower and upper (endpoints included) from a secure random
sequence. |
double |
nextUniform(double lower,
double upper)
Deprecated. Generates a uniformly distributed random value from the open interval (lower, upper) (i.e., endpoints excluded). |
double |
nextUniform(double lower,
double upper,
boolean lowerInclusive)
Deprecated. Generates a uniformly distributed random value from the interval (lower, upper) or the interval [lower, upper) . |
Method Detail |
---|
String nextHexString(int len) throws NotStrictlyPositiveException
len
.
The generated string will be random, but not cryptographically
secure. To generate cryptographically secure strings, use
nextSecureHexString(int)
.
len
- the length of the string to be generated
len
NotStrictlyPositiveException
- if len <= 0
int nextInt(int lower, int upper) throws NumberIsTooLargeException
lower
and upper
(endpoints included).
The generated integer will be random, but not cryptographically secure.
To generate cryptographically secure integer sequences, use
nextSecureInt(int, int)
.
lower
- lower bound for generated integerupper
- upper bound for generated integer
lower
and less than or equal to upper
NumberIsTooLargeException
- if lower >= upper
long nextLong(long lower, long upper) throws NumberIsTooLargeException
lower
and upper
(endpoints included).
The generated long integer values will be random, but not
cryptographically secure. To generate cryptographically secure sequences
of longs, use nextSecureLong(long, long)
.
lower
- lower bound for generated long integerupper
- upper bound for generated long integer
lower
and
less than or equal to upper
NumberIsTooLargeException
- if lower >= upper
String nextSecureHexString(int len) throws NotStrictlyPositiveException
If cryptographic security is not required, use
nextHexString(int)
.
len
- the length of the string to be generated
len
NotStrictlyPositiveException
- if len <= 0
int nextSecureInt(int lower, int upper) throws NumberIsTooLargeException
lower
and upper
(endpoints included) from a secure random sequence.
Sequences of integers generated using this method will be
cryptographically secure. If cryptographic security is not required,
nextInt(int, int)
should be used instead of this method.
Definition: Secure Random Sequence
lower
- lower bound for generated integerupper
- upper bound for generated integer
lower
and less
than or equal to upper
.
NumberIsTooLargeException
- if lower >= upper
.long nextSecureLong(long lower, long upper) throws NumberIsTooLargeException
lower
and upper
(endpoints included) from a secure random
sequence.
Sequences of long values generated using this method will be
cryptographically secure. If cryptographic security is not required,
nextLong(long, long)
should be used instead of this method.
Definition: Secure Random Sequence
lower
- lower bound for generated integerupper
- upper bound for generated integer
lower
and
less than or equal to upper
.
NumberIsTooLargeException
- if lower >= upper
.long nextPoisson(double mean) throws NotStrictlyPositiveException
Definition: Poisson Distribution
mean
- the mean of the Poisson distribution
NotStrictlyPositiveException
- if mean <= 0
.double nextGaussian(double mu, double sigma) throws NotStrictlyPositiveException
Definition: Normal Distribution
mu
- the mean of the distributionsigma
- the standard deviation of the distribution
NotStrictlyPositiveException
- if sigma <= 0
.double nextExponential(double mean) throws NotStrictlyPositiveException
Definition: Exponential Distribution
mean
- the mean of the distribution
NotStrictlyPositiveException
- if mean <= 0
.double nextUniform(double lower, double upper) throws NumberIsTooLargeException, NotFiniteNumberException, NotANumberException
(lower, upper)
(i.e., endpoints excluded).
Definition:
Uniform Distribution lower
and upper - lower
are the
location and scale parameters, respectively.
lower
- the exclusive lower bound of the supportupper
- the exclusive upper bound of the support
NumberIsTooLargeException
- if lower >= upper
NotFiniteNumberException
- if one of the bounds is infinite
NotANumberException
- if one of the bounds is NaNdouble nextUniform(double lower, double upper, boolean lowerInclusive) throws NumberIsTooLargeException, NotFiniteNumberException, NotANumberException
(lower, upper)
or the interval [lower, upper)
. The lower
bound is thus optionally included, while the upper bound is always
excluded.
Definition:
Uniform Distribution lower
and upper - lower
are the
location and scale parameters, respectively.
lower
- the lower bound of the supportupper
- the exclusive upper bound of the supportlowerInclusive
- true
if the lower bound is inclusive
(lower, upper)
interval, if lowerInclusive
is false
, or in the
[lower, upper)
interval, if lowerInclusive
is
true
NumberIsTooLargeException
- if lower >= upper
NotFiniteNumberException
- if one of the bounds is infinite
NotANumberException
- if one of the bounds is NaNint[] nextPermutation(int n, int k) throws NumberIsTooLargeException, NotStrictlyPositiveException
k
whose entries are selected
randomly, without repetition, from the integers 0, ..., n - 1
(inclusive).
Generated arrays represent permutations of n
taken k
at a
time.
n
- the domain of the permutationk
- the size of the permutation
k
-permutation of n
, as an array of
integers
NumberIsTooLargeException
- if k > n
.
NotStrictlyPositiveException
- if k <= 0
.Object[] nextSample(Collection<?> c, int k) throws NumberIsTooLargeException, NotStrictlyPositiveException
k
objects selected randomly from the
Collection c
.
Sampling from c
is without replacement; but if c
contains
identical objects, the sample may include repeats. If all elements of
c
are distinct, the resulting object array represents a
Simple Random Sample of size k
from the elements of
c
.
c
- the collection to be sampledk
- the size of the sample
k
elements from c
NumberIsTooLargeException
- if k > c.size()
.
NotStrictlyPositiveException
- if k <= 0
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |