当前位置: 首页>>代码示例>>Java>>正文


Java DiscreteRNG类代码示例

本文整理汇总了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);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:27,代码来源:TestTFileSeek.java

示例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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestTFileSeek.java

示例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);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:16,代码来源:KVGenerator.java

示例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;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:8,代码来源:KeySampler.java


注:本文中的org.apache.hadoop.io.file.tfile.RandomDistribution.DiscreteRNG类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。