本文整理汇总了Java中org.apache.hadoop.io.file.tfile.RandomDistribution.DiscreteRNG类的典型用法代码示例。如果您正苦于以下问题:Java DiscreteRNG类的具体用法?Java DiscreteRNG怎么用?Java DiscreteRNG使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DiscreteRNG类属于org.apache.hadoop.io.file.tfile.RandomDistribution包,在下文中一共展示了DiscreteRNG类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.hadoop.io.file.tfile.RandomDistribution.DiscreteRNG; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
if (options == null) {
options = new MyOptions(new String[0]);
}
conf = new Configuration();
conf.setInt("tfile.fs.input.buffer.size", options.fsInputBufferSize);
conf.setInt("tfile.fs.output.buffer.size", options.fsOutputBufferSize);
path = new Path(new Path(options.rootDir), options.file);
fs = path.getFileSystem(conf);
timer = new NanoTimer(false);
rng = new Random(options.seed);
keyLenGen =
new RandomDistribution.Zipf(new Random(rng.nextLong()),
options.minKeyLen, options.maxKeyLen, 1.2);
DiscreteRNG valLenGen =
new RandomDistribution.Flat(new Random(rng.nextLong()),
options.minValLength, options.maxValLength);
DiscreteRNG wordLenGen =
new RandomDistribution.Flat(new Random(rng.nextLong()),
options.minWordLen, options.maxWordLen);
kvGen =
new KVGenerator(rng, true, keyLenGen, valLenGen, wordLenGen,
options.dictSize);
}
示例2: setUp
import org.apache.hadoop.io.file.tfile.RandomDistribution.DiscreteRNG; //导入依赖的package包/类
@Override
public void setUp() throws IOException {
if (options == null) {
options = new MyOptions(new String[0]);
}
conf = new Configuration();
conf.setInt("tfile.fs.input.buffer.size", options.fsInputBufferSize);
conf.setInt("tfile.fs.output.buffer.size", options.fsOutputBufferSize);
path = new Path(new Path(options.rootDir), options.file);
fs = path.getFileSystem(conf);
timer = new NanoTimer(false);
rng = new Random(options.seed);
keyLenGen =
new RandomDistribution.Zipf(new Random(rng.nextLong()),
options.minKeyLen, options.maxKeyLen, 1.2);
DiscreteRNG valLenGen =
new RandomDistribution.Flat(new Random(rng.nextLong()),
options.minValLength, options.maxValLength);
DiscreteRNG wordLenGen =
new RandomDistribution.Flat(new Random(rng.nextLong()),
options.minWordLen, options.maxWordLen);
kvGen =
new KVGenerator(rng, true, keyLenGen, valLenGen, wordLenGen,
options.dictSize);
}
示例3: KVGenerator
import org.apache.hadoop.io.file.tfile.RandomDistribution.DiscreteRNG; //导入依赖的package包/类
public KVGenerator(Random random, boolean sorted, DiscreteRNG keyLenRNG,
DiscreteRNG valLenRNG, DiscreteRNG wordLenRNG, int dictSize) {
this.random = random;
dict = new byte[dictSize][];
this.sorted = sorted;
this.keyLenRNG = keyLenRNG;
this.valLenRNG = valLenRNG;
for (int i = 0; i < dictSize; ++i) {
int wordLen = wordLenRNG.nextInt();
dict[i] = new byte[wordLen];
random.nextBytes(dict[i]);
}
lastKey = new BytesWritable();
fillKey(lastKey);
}
示例4: KeySampler
import org.apache.hadoop.io.file.tfile.RandomDistribution.DiscreteRNG; //导入依赖的package包/类
public KeySampler(Random random, RawComparable first, RawComparable last,
DiscreteRNG keyLenRNG) throws IOException {
this.random = random;
min = keyPrefixToInt(first);
max = keyPrefixToInt(last);
this.keyLenRNG = keyLenRNG;
}