Package org.eclipse.epsilon.emg.random
Interface IEmgRandomGenerator<K extends CharacterSet>
- All Superinterfaces:
org.apache.commons.math3.random.RandomGenerator
- All Known Implementing Classes:
EmgOperationContributor
,EmgRandomGenerator
public interface IEmgRandomGenerator<K extends CharacterSet>
extends org.apache.commons.math3.random.RandomGenerator
The Random Attribute Generator interface defines the different available
methods to generate random data. This can be boolean values, numbers and
strings, or more specialized data as names, cities, emails, phone numbers,
etc.
- Author:
- Hoacio Hoyos
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
static enum
-
Method Summary
Modifier and TypeMethodDescriptionnextAddTo
(int n, int m) Returns an array of n integers that addvar to m.double
nextBinomialValue
(int numberOfTrials, double probabilityOfSuccess) Generates a random value from the Binomial Distribution.nextCamelCaseString
(int length, int minWordLength) Generates a random string of the given length using the specified character set formatted in CameCase format.nextCapitalisedString
(String charSet, int length) Next capitalised string.double
nextDobule
(double upper) Returns a pseudorandom, uniformly distributed double value between 0 (inclusive) and the specified value (exclusive), drawn from this random attribute generator's sequence.double
nextDobule
(double lower, double upper) Returns a pseudorandom, uniformly distributed double value between lower and upper (endpoints included), drawn from this random attribute generator's sequence.double
nextExponentialValue
(double mean) Generates a random value from the Exponential Distribution.nextFromCollection
(Collection<?> c) Returns a single object selected randomly from the Collection c using a uniform distribution.nextFromList
(String listID) Returns a single objects selected randomly from the list using a uniform distribution.nextFromListAsSample
(String listID) The list is treated as a sample without replacement, i.e.nextHttpURI
(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) Generates a random URI that complies to: http:[//host[:port]][/]path[?query][#fragment] The scheme is The host is generated from a random string and uses a top-level domain.int
nextInteger
(int upper) Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random attribute generator's sequence.int
nextInteger
(int lower, int upper) Returns a pseudorandom, uniformly distributed int value between lower and upper (endpoints included), drawn from this random attribute generator's sequence.long
nextLong
(long upper) Returns a pseudorandom, uniformly distributed long value between 0 (inclusive) and the specified value (exclusive), drawn from this random attribute generator's sequence.long
nextLong
(long lower, long upper) Returns a pseudorandom, uniformly distributed long value between lower and upper (endpoints included), drawn from this random attribute generator's sequence.nextSample
(String listID, int k) Returns an array of k objects selected randomly from the list using a uniform distribution.nextSample
(Collection<?> c, int k) Returns an array of k objects selected randomly from the Collection c using a uniform distribution.nextString
(String charSet, int length) Generates a random string of the given length using the specified character set.nextURI()
Generates a random URI.nextURI
(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) Generates a random URI that complies to: scheme:[//[user:password@]host[:port]][/]path[?query][#fragment] The scheme is randomly selected from: http, ssh and ftp.double
Returns the next pseudorandom, value from this random attribute generator's sequence.Methods inherited from interface org.apache.commons.math3.random.RandomGenerator
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed, setSeed, setSeed
-
Method Details
-
nextAddTo
Returns an array of n integers that addvar to m.- Parameters:
n
-m
-- Returns:
- Throws:
EolRuntimeException
-
nextBinomialValue
double nextBinomialValue(int numberOfTrials, double probabilityOfSuccess) throws EolRuntimeException Generates a random value from the Binomial Distribution.- Parameters:
Distribution
-- Returns:
- Throws:
EolRuntimeException
-
nextCamelCaseString
Generates a random string of the given length using the specified character set formatted in CameCase format. Characters are picked from the LETTER set using a uniform distribution.- Parameters:
length
- the lengthminWordLenght
- the minimum word length- Returns:
- the string
- Throws:
EolRuntimeException
-
nextCapitalisedString
Next capitalised string.- Parameters:
charSet
- the char setlength
- the length- Returns:
- the string
-
nextDobule
Returns a pseudorandom, uniformly distributed double value between 0 (inclusive) and the specified value (exclusive), drawn from this random attribute generator's sequence.- Parameters:
upper
-- Returns:
- Throws:
EolRuntimeException
-
nextDobule
Returns a pseudorandom, uniformly distributed double value between lower and upper (endpoints included), drawn from this random attribute generator's sequence.- Parameters:
lower
-upper
-- Returns:
- Throws:
EolRuntimeException
-
nextExponentialValue
Generates a random value from the Exponential Distribution.- Parameters:
Distribution
-- Returns:
- Throws:
EolRuntimeException
-
nextFromCollection
Returns a single object selected randomly from the Collection c using a uniform distribution.- Parameters:
list
- the list- Returns:
- the t
-
nextFromList
Returns a single objects selected randomly from the list using a uniform distribution. Particular implementations need to define what a valid listID is and how the data associated with it will be retrieved.- Parameters:
listID
- the listID- Returns:
- the t
- Throws:
EolRuntimeException
-
nextFromListAsSample
The list is treated as a sample without replacement, i.e. each call will return a unique member of the list. Throws an exception if list is empty or if the method is invoked more times than the number of items in the list. Particular implementations need to define what a valid listID is and how the data associated with it will be retrieved.- Parameters:
listID
-- Returns:
- Throws:
EolRuntimeException
-
nextHttpURI
String nextHttpURI(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) throws EolRuntimeException Generates a random URI that complies to: http:[//host[:port]][/]path[?query][#fragment] The scheme is The host is generated from a random string and uses a top-level domain. The optional parameters will add additional information to the URI. The number of paths and queries are random between 1 and 4.- Parameters:
addPort
-addPath
-addQuery
-addFragment
-- Returns:
- Throws:
EolRuntimeException
-
nextInteger
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random attribute generator's sequence.- Parameters:
upper
-- Returns:
- Throws:
EolRuntimeException
-
nextInteger
Returns a pseudorandom, uniformly distributed int value between lower and upper (endpoints included), drawn from this random attribute generator's sequence.- Parameters:
lower
-upper
-- Returns:
- Throws:
EolRuntimeException
-
nextLong
Returns a pseudorandom, uniformly distributed long value between 0 (inclusive) and the specified value (exclusive), drawn from this random attribute generator's sequence.- Parameters:
upper
-- Returns:
- Throws:
EolRuntimeException
-
nextLong
Returns a pseudorandom, uniformly distributed long value between lower and upper (endpoints included), drawn from this random attribute generator's sequence.- Parameters:
lower
-upper
-- Returns:
- Throws:
EolRuntimeException
-
nextSample
Returns an array of k objects selected randomly from the Collection c using a uniform distribution. Particular implementations need to define what a valid listID is and how the data associated with it will be retrieved. 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 collection represents a Simple Random Sample of size k from the elements of c.- Throws:
EolRuntimeException
-
nextSample
Returns an array of k objects selected randomly from the list using a uniform distribution. Particular implementations need to define what a valid listID is and how the data associated with it will be retrieved. Sampling from the list is without replacement; but if the list contains identical objects, the sample may include repeats. If all elements of the list are distinct, the resulting object collection represents a Simple Random Sample of size k from the elements of c.- Throws:
EolRuntimeException
-
nextString
Generates a random string of the given length using the specified character set. Characters are picked from the set using a uniform distribution.- Parameters:
charSet
-length
-- Returns:
-
nextURI
Generates a random URI. The port, path, query and fragment are added randomly.- Returns:
- Throws:
EolRuntimeException
-
nextURI
String nextURI(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) throws EolRuntimeException Generates a random URI that complies to: scheme:[//[user:password@]host[:port]][/]path[?query][#fragment] The scheme is randomly selected from: http, ssh and ftp. For ssh and ftp, a user and pasword are randomly generated. The host is generated from a random string and uses a top-level domain. The optional parameters will add additional information to the URI. The number of paths and queries are random between 1 and 4.- Parameters:
addPort
-addPath
-addQuery
-addFragment
-- Returns:
- Throws:
EolRuntimeException
-
nextValue
Returns the next pseudorandom, value from this random attribute generator's sequence. The value is picked from the defined distribution.- Parameters:
Distribution
-- Returns:
- Throws:
EolRuntimeException
-