Class RandomGenerator<T>
- java.lang.Object
-
- org.apache.flink.streaming.api.functions.source.datagen.RandomGenerator<T>
-
- All Implemented Interfaces:
Serializable,Iterator<T>,DataGenerator<T>
@Experimental public abstract class RandomGenerator<T> extends Object implements DataGenerator<T>
Random generator.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RandomGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> RandomGenerator<T[]>arrayGenerator(DataGenerator<T> generator, int len)static RandomGenerator<Boolean>booleanGenerator()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)RandomGenerator<T>withNullRate(float nullRate)RandomGenerator<T>withVarLen(boolean varLen)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.streaming.api.functions.source.datagen.DataGenerator
snapshotState
-
Methods inherited from interface java.util.Iterator
forEachRemaining, next, remove
-
-
-
-
Method Detail
-
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
public RandomGenerator<T> withNullRate(float nullRate)
-
withVarLen
public RandomGenerator<T> withVarLen(boolean varLen)
-
longGenerator
public static RandomGenerator<Long> longGenerator(long min, long max)
-
intGenerator
public static RandomGenerator<Integer> intGenerator(int min, int max)
-
shortGenerator
public static RandomGenerator<Short> shortGenerator(short min, short max)
-
byteGenerator
public static RandomGenerator<Byte> byteGenerator(byte min, byte max)
-
floatGenerator
public static RandomGenerator<Float> floatGenerator(float min, float max)
-
doubleGenerator
public static RandomGenerator<Double> doubleGenerator(double min, double max)
-
stringGenerator
public static RandomGenerator<String> stringGenerator(int len)
-
booleanGenerator
public static RandomGenerator<Boolean> booleanGenerator()
-
arrayGenerator
public static <T> RandomGenerator<T[]> arrayGenerator(DataGenerator<T> generator, int len)
-
mapGenerator
public static <K,V> RandomGenerator<Map<K,V>> mapGenerator(DataGenerator<K> key, DataGenerator<V> value, int size)
-
-