function generatePrivateKey(randomBits = null) {
  if (randomBits) {
    // create 256-bit hash using the random bits
    return createKeccakHash('keccak256')
      .update(randomBits)
      .digest('hex')
  }

  // generate the random string of bits (needs to be larger than 256)
  const { base2 } = generateRandomNumber(512)

  // recursively call this function
  return generatePrivateKey(base2)
}
/**
 * Generates a private key, either at random or from supplied random number (in bits)
 *
 * @property {Number} [bits=256] - number of bits to generate a random number
 *
 * @returns {String} - Returns private key as hexadecimal string
 */
Generates a private key, either at random or from supplied random number (in bits)
@property {Number} [bits=256] - number of bits to generate a random number

@returns {String} - Returns private key as hexadecimal string
Generates a private key either at random or from supplied random number ( in bits ) @property { Number } [ bits = 256 ] - number of bits to generate a random number @returns { String } - Returns private key as hexadecimal string
function generatePrivateKey(randomBits = null) {
  if (randomBits) {
    return createKeccakHash('keccak256')
      .update(randomBits)
      .digest('hex')
  }
  const { base2 } = generateRandomNumber(512)
  return generatePrivateKey(base2)
}
function generatePrivateKey ( randomBits = null ) { if ( randomBits ) { return createKeccakHash ( 'keccak256' ) . update ( randomBits ) . digest ( 'hex' ) } const { base2 } = generateRandomNumber ( 512 ) return generatePrivateKey ( base2 ) }
Generates a private key, either at random or from supplied random number (in bits)
 @property {Number} [bits=256] - number of bits to generate a random number
Generates a private key either at random or from supplied random number ( in bits ) @property { Number } [ bits = 256 ] - number of bits to generate a random number
// create 256-bit hash using the random bits // generate the random string of bits (needs to be larger than 256) // recursively call this function