index.js
function floatFromBuffer (buf) {
  if (buf.length < FLOAT_ENTROPY_BYTES) {
    throw new Error(
      'buffer must contain at least ' + FLOAT_ENTROPY_BYTES + ' bytes of entropy'
    )
  }
  var position = 0

  // http://stackoverflow.com/questions/15753019/floating-point-number-from-crypto-randombytes-in-javascript
  return (((((((
    buf[position++] % 32) / 32 +
    buf[position++]) / 256 +
    buf[position++]) / 256 +
    buf[position++]) / 256 +
    buf[position++]) / 256 +
    buf[position++]) / 256 +
    buf[position]) / 256
}
function floatFromBuffer (buf) {
  if (buf.length < FLOAT_ENTROPY_BYTES) {
    throw new Error(
      'buffer must contain at least ' + FLOAT_ENTROPY_BYTES + ' bytes of entropy'
    )
  }
  var position = 0

  // http://stackoverflow.com/questions/15753019/floating-point-number-from-crypto-randombytes-in-javascript
  return (((((((
    buf[position++] % 32) / 32 +
    buf[position++]) / 256 +
    buf[position++]) / 256 +
    buf[position++]) / 256 +
    buf[position++]) / 256 +
    buf[position++]) / 256 +
    buf[position]) / 256
}
function floatFromBuffer ( buf ) { if ( buf . length < FLOAT_ENTROPY_BYTES ) { throw new Error ( 'buffer must contain at least ' + FLOAT_ENTROPY_BYTES + ' bytes of entropy' ) } var position = 0 // http://stackoverflow.com/questions/15753019/floating-point-number-from-crypto-randombytes-in-javascript return ( ( ( ( ( ( ( buf [ position ++ ] % 32 ) / 32 + buf [ position ++ ] ) / 256 + buf [ position ++ ] ) / 256 + buf [ position ++ ] ) / 256 + buf [ position ++ ] ) / 256 + buf [ position ++ ] ) / 256 + buf [ position ] ) / 256 }
Given a buffer containing bytes of entropy, generate a double-precision
64-bit float.

@param {Buffer} buf a buffer of bytes
@returns {Number} a float
Given a buffer containing bytes of entropy generate a double - precision 64 - bit float .