PeterO.RandomGenerator.Uniform C# (CSharp) Method

Uniform() public method

Returns a uniformly-distributed 64-bit floating-point number from 0 and up, but less than 1.
public Uniform ( ) : double
return double
        public double Uniform()
        {
            var b = new byte[7];
              this.valueIrg.GetBytes(b, 0, 7);
              var lb = (long)b[0] & 0xffL;
              lb |= ((long)b[1] & 0xffL) << 8;
              lb |= ((long)b[2] & 0xffL) << 16;
              lb |= ((long)b[3] & 0xffL) << 24;
              lb |= ((long)b[4] & 0xffL) << 32;
              lb |= ((long)b[5] & 0xffL) << 40;
              lb |= ((long)b[6] & 0xfL) << 48;
              lb |= 0x3ffL << 52;
              return BitConverter.Int64BitsToDouble(lb) - 1.0;
        }

Same methods

RandomGenerator::Uniform ( double max ) : double
RandomGenerator::Uniform ( double min, double max ) : double