code: async function(min, max) {
      if (max.cmp(min) <= 0) {
        throw new Error('Illegal parameter value: max <= min');
      }
  
      const modulus = max.sub(min);
      const bytes = modulus.byteLength();
  
      // Using a while loop is necessary to avoid bias introduced by the mod operation.
      // However, we request 64 extra random bits so that the bias is negligible.
      // Section B.1.1 here: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
      const r = new BN(await this.getRandomBytes(bytes + 8));
      return r.mod(modulus).add(min);
    }
docs: Create a secure random MPI that is greater than or equal to min and less than max.
  @param {module:type/mpi} min Lower bound, included
  @param {module:type/mpi} max Upper bound, excluded
  @returns {module:BN} Random MPI
  @async