PeterO.RandomGenerator.UniformSingle C# (CSharp) Method

UniformSingle() public method

Returns a uniformly-distributed 32-bit floating-point number from 0 and up, but less than 1.
public UniformSingle ( ) : double
return double
        public double UniformSingle()
        {
            var b = new byte[3];
              this.valueIrg.GetBytes(b, 0, 3);
              var lb = (int)b[0] & 0xff;
              lb |= ((int)b[1] & 0xff) << 8;
              lb |= ((int)b[2] & 0x7f) << 16;
              lb |= 0x7f << 23;
              return BitConverter.ToSingle(
               BitConverter.GetBytes(lb),
               0) - 1.0;
        }