예제 #1
0
 /// <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;
 }
예제 #2
0
        /// <exception cref="System.IO.IOException"/>
        private int KeyPrefixToInt(RawComparable key)
        {
            byte[] b = key.Buffer();
            int    o = key.Offset();

            return((b[o] & unchecked ((int)(0xff))) << 24 | (b[o + 1] & unchecked ((int)(0xff))
                                                             ) << 16 | (b[o + 2] & unchecked ((int)(0xff))) << 8 | (b[o + 3] & unchecked ((int)
                                                                                                                                          (0xff))));
        }