public class EmgRandomGenerator extends Object implements IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
IEmgRandomGenerator.DefaultCharacterSet, IEmgRandomGenerator.Distribution
Constructor and Description |
---|
EmgRandomGenerator(IEolContext context)
Instantiates a new emg random generator.
|
EmgRandomGenerator(IEolContext context,
long seed)
Instantiates a new emg random generator.
|
Modifier and Type | Method and Description |
---|---|
org.apache.commons.math3.random.RandomDataGenerator |
getGenerator() |
List<Integer> |
getIndex(String listID,
int size,
Map<String,List<Integer>> sampleList) |
protected List<String> |
getValuesFromList(String list)
Gets the values from list.
|
List<Integer> |
nextAddTo(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.
|
boolean |
nextBoolean() |
void |
nextBytes(byte[] bytes) |
String |
nextCamelCaseString(int length,
int minWordLength)
Generates a random string of the given length using the specified character
set formatted in
CameCase format.
|
String |
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 |
nextDouble() |
double |
nextExponentialValue(double mean)
Generates a random value from the Exponential Distribution.
|
float |
nextFloat() |
Object |
nextFromCollection(Collection<?> c)
Returns a single object selected randomly from the Collection c using a
uniform distribution.
|
Object |
nextFromList(String listID)
The listID must be the name of a parameter in the launch configuration.
|
Object |
nextFromListAsSample(String listID)
The listID must be the name of a parameter in the launch configuration.
|
double |
nextGaussian() |
String |
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 |
nextInt() |
int |
nextInt(int n) |
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 |
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.
|
List<Object> |
nextSample(Collection<?> c,
int k)
Returns an array of k objects selected randomly from the Collection c using a
uniform distribution.
|
List<Object> |
nextSample(String listID,
int k)
The listID must be the name of a parameter in the launch configuration.
|
String |
nextString(String charSet,
int length)
Generates a random string of the given length using the specified character
set.
|
String |
nextURI()
Generates a random URI.
|
String |
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 |
nextValue()
Returns the next pseudorandom, value from this random attribute generator's
sequence.
|
void |
setSeed(int seed) |
void |
setSeed(int[] seed) |
void |
setSeed(long seed) |
void |
useBinomialDistribution(int numberOfTrials,
double probabilityOfSuccess)
Use binomial distribution.
|
void |
useExponentialDistribution(double mean)
Use exponential distribution.
|
public EmgRandomGenerator(IEolContext context)
context
- the contextpublic EmgRandomGenerator(IEolContext context, long seed)
context
- the contextseed
- the seedpublic org.apache.commons.math3.random.RandomDataGenerator getGenerator()
public List<Integer> getIndex(String listID, int size, Map<String,List<Integer>> sampleList) throws EolRuntimeException
EolRuntimeException
public List<Integer> nextAddTo(int n, int m) throws EolRuntimeException
IEmgRandomGenerator
nextAddTo
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public double nextBinomialValue(int numberOfTrials, double probabilityOfSuccess)
IEmgRandomGenerator
nextBinomialValue
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
public boolean nextBoolean()
nextBoolean
in interface org.apache.commons.math3.random.RandomGenerator
public void nextBytes(byte[] bytes)
nextBytes
in interface org.apache.commons.math3.random.RandomGenerator
public String nextCamelCaseString(int length, int minWordLength) throws EolRuntimeException
IEmgRandomGenerator
nextCamelCaseString
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
length
- the lengthEolRuntimeException
public String nextCapitalisedString(String charSet, int length)
IEmgRandomGenerator
nextCapitalisedString
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
charSet
- the char setlength
- the lengthpublic double nextDobule(double upper) throws EolRuntimeException
IEmgRandomGenerator
nextDobule
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public double nextDobule(double lower, double upper)
IEmgRandomGenerator
nextDobule
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
public double nextDouble()
nextDouble
in interface org.apache.commons.math3.random.RandomGenerator
public double nextExponentialValue(double mean)
IEmgRandomGenerator
nextExponentialValue
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
public float nextFloat()
nextFloat
in interface org.apache.commons.math3.random.RandomGenerator
public Object nextFromCollection(Collection<?> c)
IEmgRandomGenerator
nextFromCollection
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
public Object nextFromList(String listID) throws EolRuntimeException
nextFromList
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
listID
- the listIDEolRuntimeException
IEmgRandomGenerator.nextFromList(java.lang.String)
public Object nextFromListAsSample(String listID) throws EolRuntimeException
nextFromListAsSample
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
org.eclipse.epsilon.emg.random.IEmgRandomGenerator#nextSampleFromList(java.lang.String)
public double nextGaussian()
nextGaussian
in interface org.apache.commons.math3.random.RandomGenerator
public String nextHttpURI(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) throws EolRuntimeException
IEmgRandomGenerator
nextHttpURI
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public int nextInt()
nextInt
in interface org.apache.commons.math3.random.RandomGenerator
public int nextInt(int n)
nextInt
in interface org.apache.commons.math3.random.RandomGenerator
public int nextInteger(int upper) throws EolRuntimeException
IEmgRandomGenerator
nextInteger
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public int nextInteger(int lower, int upper) throws EolRuntimeException
IEmgRandomGenerator
nextInteger
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public long nextLong()
nextLong
in interface org.apache.commons.math3.random.RandomGenerator
public long nextLong(long upper) throws EolRuntimeException
IEmgRandomGenerator
nextLong
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public long nextLong(long lower, long upper) throws EolRuntimeException
IEmgRandomGenerator
nextLong
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public List<Object> nextSample(Collection<?> c, int k) throws EolRuntimeException
IEmgRandomGenerator
nextSample
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public List<Object> nextSample(String listID, int k) throws EolRuntimeException
nextSample
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
IEmgRandomGenerator.nextSample(java.lang.String,
int)
public String nextString(String charSet, int length)
IEmgRandomGenerator
nextString
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
public String nextURI() throws EolRuntimeException
IEmgRandomGenerator
nextURI
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public String nextURI(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) throws EolRuntimeException
IEmgRandomGenerator
nextURI
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
EolRuntimeException
public double nextValue()
IEmgRandomGenerator
nextValue
in interface IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
public void setSeed(int seed)
setSeed
in interface org.apache.commons.math3.random.RandomGenerator
public void setSeed(int[] seed)
setSeed
in interface org.apache.commons.math3.random.RandomGenerator
public void setSeed(long seed)
setSeed
in interface org.apache.commons.math3.random.RandomGenerator
public void useBinomialDistribution(int numberOfTrials, double probabilityOfSuccess)
numberOfTrials
- the number of trialsprobabilityOfSuccess
- the probability of successpublic void useExponentialDistribution(double mean)
mean
- the meanprotected List<String> getValuesFromList(String list) throws EolRuntimeException
list
- the listEolRuntimeException
- the eol runtime exceptionCopyright © 2020. All rights reserved.