/// <exception cref="System.IO.IOException"/> public KeySampler(Random random, RawComparable first, RawComparable last, RandomDistribution.DiscreteRNG keyLenRNG) { this.random = random; min = KeyPrefixToInt(first); max = KeyPrefixToInt(last); this.keyLenRNG = keyLenRNG; }
public KVGenerator(Random random, bool sorted, RandomDistribution.DiscreteRNG keyLenRNG , RandomDistribution.DiscreteRNG valLenRNG, RandomDistribution.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); }
/// <exception cref="System.IO.IOException"/> protected override void SetUp() { if (options == null) { options = new TestTFileSeek.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); RandomDistribution.DiscreteRNG valLenGen = new RandomDistribution.Flat(new Random (rng.NextLong()), options.minValLength, options.maxValLength); RandomDistribution.DiscreteRNG wordLenGen = new RandomDistribution.Flat(new Random (rng.NextLong()), options.minWordLen, options.maxWordLen); kvGen = new KVGenerator(rng, true, keyLenGen, valLenGen, wordLenGen, options.dictSize ); }