Interface RandomData
- All Known Implementing Classes:
RandomDataGenerator,RandomDataImpl
-
Method Summary
Modifier and TypeMethodDescriptiondoublenextExponential(double mean) Deprecated.Generates a random value from the exponential distribution with specified mean.doublenextGaussian(double mu, double sigma) Deprecated.Generates a random value from the Normal (or Gaussian) distribution with specified mean and standard deviation.nextHexString(int len) Deprecated.Generates a random string of hex characters of lengthlen.intnextInt(int lower, int upper) Deprecated.Generates a uniformly distributed random integer betweenlowerandupper(endpoints included).longnextLong(long lower, long upper) Deprecated.Generates a uniformly distributed random long integer betweenlowerandupper(endpoints included).int[]nextPermutation(int n, int k) Deprecated.Generates an integer array of lengthkwhose entries are selected randomly, without repetition, from the integers0, ..., n - 1(inclusive).longnextPoisson(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 ofkobjects selected randomly from the Collectionc.nextSecureHexString(int len) Deprecated.Generates a random string of hex characters from a secure random sequence.intnextSecureInt(int lower, int upper) Deprecated.Generates a uniformly distributed random integer betweenlowerandupper(endpoints included) from a secure random sequence.longnextSecureLong(long lower, long upper) Deprecated.Generates a uniformly distributed random long integer betweenlowerandupper(endpoints included) from a secure random sequence.doublenextUniform(double lower, double upper) Deprecated.Generates a uniformly distributed random value from the open interval(lower, upper)(i.e., endpoints excluded).doublenextUniform(double lower, double upper, boolean lowerInclusive) Deprecated.Generates a uniformly distributed random value from the interval(lower, upper)or the interval[lower, upper).
-
Method Details
-
nextHexString
Deprecated.Generates a random string of hex characters of lengthlen.The generated string will be random, but not cryptographically secure. To generate cryptographically secure strings, use
nextSecureHexString(int).- Parameters:
len- the length of the string to be generated- Returns:
- a random string of hex characters of length
len - Throws:
NotStrictlyPositiveException- iflen <= 0
-
nextInt
Deprecated.Generates a uniformly distributed random integer betweenlowerandupper(endpoints included).The generated integer will be random, but not cryptographically secure. To generate cryptographically secure integer sequences, use
nextSecureInt(int, int).- Parameters:
lower- lower bound for generated integerupper- upper bound for generated integer- Returns:
- a random integer greater than or equal to
lowerand less than or equal toupper - Throws:
NumberIsTooLargeException- iflower >= upper
-
nextLong
Deprecated.Generates a uniformly distributed random long integer betweenlowerandupper(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).- Parameters:
lower- lower bound for generated long integerupper- upper bound for generated long integer- Returns:
- a random long integer greater than or equal to
lowerand less than or equal toupper - Throws:
NumberIsTooLargeException- iflower >= upper
-
nextSecureHexString
Deprecated.Generates a random string of hex characters from a secure random sequence.If cryptographic security is not required, use
nextHexString(int).- Parameters:
len- the length of the string to be generated- Returns:
- a random string of hex characters of length
len - Throws:
NotStrictlyPositiveException- iflen <= 0
-
nextSecureInt
Deprecated.Generates a uniformly distributed random integer betweenlowerandupper(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
- Parameters:
lower- lower bound for generated integerupper- upper bound for generated integer- Returns:
- a random integer greater than or equal to
lowerand less than or equal toupper. - Throws:
NumberIsTooLargeException- iflower >= upper.
-
nextSecureLong
Deprecated.Generates a uniformly distributed random long integer betweenlowerandupper(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
- Parameters:
lower- lower bound for generated integerupper- upper bound for generated integer- Returns:
- a random long integer greater than or equal to
lowerand less than or equal toupper. - Throws:
NumberIsTooLargeException- iflower >= upper.
-
nextPoisson
Deprecated.Generates a random value from the Poisson distribution with the given mean.Definition: Poisson Distribution
- Parameters:
mean- the mean of the Poisson distribution- Returns:
- a random value following the specified Poisson distribution
- Throws:
NotStrictlyPositiveException- ifmean <= 0.
-
nextGaussian
Deprecated.Generates a random value from the Normal (or Gaussian) distribution with specified mean and standard deviation.Definition: Normal Distribution
- Parameters:
mu- the mean of the distributionsigma- the standard deviation of the distribution- Returns:
- a random value following the specified Gaussian distribution
- Throws:
NotStrictlyPositiveException- ifsigma <= 0.
-
nextExponential
Deprecated.Generates a random value from the exponential distribution with specified mean.Definition: Exponential Distribution
- Parameters:
mean- the mean of the distribution- Returns:
- a random value following the specified exponential distribution
- Throws:
NotStrictlyPositiveException- ifmean <= 0.
-
nextUniform
double nextUniform(double lower, double upper) throws NumberIsTooLargeException, NotFiniteNumberException, NotANumberException Deprecated.Generates a uniformly distributed random value from the open interval(lower, upper)(i.e., endpoints excluded).Definition: Uniform Distribution
lowerandupper - lowerare the location and scale parameters, respectively.- Parameters:
lower- the exclusive lower bound of the supportupper- the exclusive upper bound of the support- Returns:
- a uniformly distributed random value between lower and upper (exclusive)
- Throws:
NumberIsTooLargeException- iflower >= upperNotFiniteNumberException- if one of the bounds is infiniteNotANumberException- if one of the bounds is NaN
-
nextUniform
double nextUniform(double lower, double upper, boolean lowerInclusive) throws NumberIsTooLargeException, NotFiniteNumberException, NotANumberException Deprecated.Generates a uniformly distributed random value from the interval(lower, upper)or the interval[lower, upper). The lower bound is thus optionally included, while the upper bound is always excluded.Definition: Uniform Distribution
lowerandupper - lowerare the location and scale parameters, respectively.- Parameters:
lower- the lower bound of the supportupper- the exclusive upper bound of the supportlowerInclusive-trueif the lower bound is inclusive- Returns:
- uniformly distributed random value in the
(lower, upper)interval, iflowerInclusiveisfalse, or in the[lower, upper)interval, iflowerInclusiveistrue - Throws:
NumberIsTooLargeException- iflower >= upperNotFiniteNumberException- if one of the bounds is infiniteNotANumberException- if one of the bounds is NaN
-
nextPermutation
Deprecated.Generates an integer array of lengthkwhose entries are selected randomly, without repetition, from the integers0, ..., n - 1(inclusive).Generated arrays represent permutations of
ntakenkat a time.- Parameters:
n- the domain of the permutationk- the size of the permutation- Returns:
- a random
k-permutation ofn, as an array of integers - Throws:
NumberIsTooLargeException- ifk > n.NotStrictlyPositiveException- ifk <= 0.
-
nextSample
Object[] nextSample(Collection<?> c, int k) throws NumberIsTooLargeException, NotStrictlyPositiveException Deprecated.Returns an array ofkobjects selected randomly from the Collectionc.Sampling from
cis without replacement; but ifccontains identical objects, the sample may include repeats. If all elements ofcare distinct, the resulting object array represents a Simple Random Sample of sizekfrom the elements ofc.- Parameters:
c- the collection to be sampledk- the size of the sample- Returns:
- a random sample of
kelements fromc - Throws:
NumberIsTooLargeException- ifk > c.size().NotStrictlyPositiveException- ifk <= 0.
-
RandomDataGeneratordirectly