Class RandomGenerator<T>
java.lang.Object
org.apache.flink.streaming.api.functions.source.datagen.RandomGenerator<T>
- All Implemented Interfaces:
Serializable,Iterator<T>,DataGenerator<T>
Random generator.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> RandomGenerator<T[]>arrayGenerator(DataGenerator<T> generator, int len) static RandomGenerator<Boolean>static RandomGenerator<Byte>byteGenerator(byte min, byte max) static RandomGenerator<Double>doubleGenerator(double min, double max) static RandomGenerator<Float>floatGenerator(float min, float max) booleanhasNext()static RandomGenerator<Integer>intGenerator(int min, int max) static RandomGenerator<Long>longGenerator(long min, long max) static <K,V> RandomGenerator<Map<K, V>> mapGenerator(DataGenerator<K> key, DataGenerator<V> value, int size) protected TnextWithNullRate(Supplier<T> supplier) voidopen(String name, org.apache.flink.runtime.state.FunctionInitializationContext context, org.apache.flink.api.common.functions.RuntimeContext runtimeContext) Open and initialize state forDataGenerator.static RandomGenerator<Short>shortGenerator(short min, short max) static RandomGenerator<String>stringGenerator(int len) withNullRate(float nullRate) withVarLen(boolean varLen) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.streaming.api.functions.source.datagen.DataGenerator
snapshotStateMethods inherited from interface java.util.Iterator
forEachRemaining, next, remove
-
Field Details
-
random
protected transient org.apache.commons.math3.random.RandomDataGenerator random -
nullRate
protected float nullRate -
varLen
protected boolean varLen
-
-
Constructor Details
-
RandomGenerator
public RandomGenerator()
-
-
Method Details
-
open
public void open(String name, org.apache.flink.runtime.state.FunctionInitializationContext context, org.apache.flink.api.common.functions.RuntimeContext runtimeContext) throws Exception Description copied from interface:DataGeneratorOpen and initialize state forDataGenerator. SeeCheckpointedFunction.initializeState(org.apache.flink.runtime.state.FunctionInitializationContext).- Specified by:
openin interfaceDataGenerator<T>- Parameters:
name- The state ofDataGeneratorshould related to this name, make sure the name of state is different.- Throws:
Exception
-
withNullRate
-
nextWithNullRate
-
withVarLen
-
hasNext
public boolean hasNext() -
longGenerator
-
intGenerator
-
shortGenerator
-
byteGenerator
-
floatGenerator
-
doubleGenerator
-
stringGenerator
-
booleanGenerator
-
arrayGenerator
-
mapGenerator
public static <K,V> RandomGenerator<Map<K,V>> mapGenerator(DataGenerator<K> key, DataGenerator<V> value, int size)
-