/* Pharmazentral Nummer is a Code 3 of 9 symbol with an extra
check digit. Now generates PZN-8.
768779
@Override
    protected void encode() {
        int l = content.length();
        String localstr;
        int zeroes, count = 0, check_digit;
        Code3Of9 c = new Code3Of9();

        if (l > 7) {
            throw new OkapiException("Input data too long");
        }

        if (!content.matches("[0-9]+")) {
            throw new OkapiException("Invalid characters in input");
        }

        localstr = "-";
        zeroes = 7 - l + 1;
        for (int i = 1; i < zeroes; i++)
            localstr += '0';

        localstr += content;

        for (int i = 1; i < 8; i++) {
            count += i * Character.getNumericValue(localstr.charAt(i));
        }

        check_digit = count % 11;
        if (check_digit == 11) {
            check_digit = 0;
        }
        if (check_digit == 10) {
            throw new OkapiException("Not a valid PZN identifier");
        }

        encodeInfo += "Check Digit: " + check_digit + "\n";

        localstr += (char)(check_digit + '0');

        c.setContent(localstr);

        readable = "PZN" + localstr;
        pattern = new String[1];
        pattern[0] = c.pattern[0];
        row_count = 1;
        row_height = new int[1];
        row_height[0] = -1;
    }
1252876
public static function getAsNumeric($p_currency)
    {
        $codes = self::getAllCodes();
        if (array_key_exists(strtoupper($p_currency), $codes)) {
            return $codes[strtoupper($p_currency)]['code'];
        }
        return false;
    }
727497
function(n, countryCode){

        const number = phoneUtil.parse(n, countryCode),
            isPossibleNumber = phoneUtil.isPossibleNumber(number),
	        res = {
                input: n,
                countryCode: countryCode,
                isPossibleNumber: isPossibleNumber,
                isPossibleNumberWithReason: phoneUtil.isPossibleNumberWithReason(number)
	        };

        if(isPossibleNumber){
            res.isPossibleNumber = true;
            res.isNumberValid = phoneUtil.isValidNumber(number);
            res.countryCode = countryCode;
            res.formatted = phoneUtil.formatInOriginalFormat(number, countryCode);
            res.national = phoneUtil.format(number, PNF.NATIONAL);
            res.international = phoneUtil.format(number, PNF.INTERNATIONAL)
        }

        switch (phoneUtil.isPossibleNumberWithReason(number)){

            case PNV.IS_POSSIBLE:
                res.isPossibleNumberWithReason = 'IS_POSSIBLE';
            break;

            case PNV.INVALID_COUNTRY_CODE:
                res.isPossibleNumberWithReason = 'INVALID_COUNTRY_CODE';
            break;

            case PNV.TOO_SHORT:
                res.isPossibleNumberWithReason = 'TOO_SHORT';
            break;

            case PNV.TOO_LONG:
                res.isPossibleNumberWithReason = 'TOO_LONG';
            break;
        }

        return res;
    }
1224440
public static boolean alg_52(int[] blz, int[] number) {
        boolean ok;

        if (number[0] == 9) {
            ok = alg_20(blz, number);

        } else {
            //Kontonummer muss 8-stellig sein (mgl: number[2] darf 0 sein, d.h. Kontonummer faengt mit 0 an
            if (number[0] != 0 || number[1] != 0 || number[2] == 0) {
                ok = false;

            } else {
                int[] weights = new int[]{4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};

                //ESER-Nummer bauen
                int[] eser = new int[12];

                int knstartindex = 4;
                while (number[knstartindex] == 0) {
                    knstartindex++;
                }

                // kontonummer -> eser
                int i = 11;
                for (int j = 9; j >= knstartindex; j--, i--) {
                    eser[i] = number[j];
                }

                //Pruefziffer number[3] muss 0 gesetzt werden
                int indexOfPruefziffer = i;
                eser[i--] = 0;

                //erste Stelle der Kontonummer;
                eser[i--] = number[2];

                for (int j = 7; j > 3; j--, i--) {
                    eser[i] = blz[j];
                }

                //Ende Eser-Nummer bauen
                int sum = addProducts(eser, 0, 11, weights, false);
                int crc = sum % 11;

                int factor = 0;
                boolean found = false;

                while (!found && factor < 10) {
                    int tocheck = (crc + factor * weights[indexOfPruefziffer]) % 11;
                    if (tocheck == 10) {
                        crc = factor;
                        found = true;
                    }
                    factor++;
                }

                ok = found && number[3] == crc;
            }
        }

        return ok;
    }
83305
public String getAccuracyDescription(int numDigits) {
    NumberFormat nf = NumberFormat.getNumberInstance();
    nf.setMaximumFractionDigits(numDigits);
    Triple<Double, Integer, Integer> accu = getAccuracyInfo();
    return nf.format(accu.first()) + "  (" + accu.second() + "/" + (accu.second() + accu.third()) + ")";
  }
227089
@Override
    public void spr(char order, char Uplo, double alpha, INDArray X, INDArray Ap) {
        if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
            OpProfiler.getInstance().processBlasCall(false, Ap, X);


        // FIXME: int cast

        if (X.data().dataType() == DataType.DOUBLE) {
            DefaultOpExecutioner.validateDataType(DataType.DOUBLE, X);
            dspr(order, Uplo, (int) X.length(), alpha, X, X.stride(-1), Ap);
        } else {
            DefaultOpExecutioner.validateDataType(DataType.FLOAT, X);
            sspr(order, Uplo, (int) X.length(), (float) alpha, X, X.stride(-1), Ap);
        }

        OpExecutionerUtil.checkForAny(Ap);
    }
631393
Rule NthRepeatNum() {
		return Sequence(
			DIGITS(),
			ZeroOrMoreS(SequenceS(FirstOf(',', '-').suppressNode(),
								DIGITS()))
		).label(NthRepeatNum);
	}
326545
public function isAlphaNum() {
        $this->check_role = 'alphaNum';
        $result = $this->checkRegex($this->value, '/^[A-Za-z0-9]+$/');
        $this->checkResult($result);
        return $this;
    }
1135095
function () {
        _gpfBinZ = 36969 * (_gpfBinZ & 65535) + (_gpfBinZ >> 16) & _gpfMax32;
        _gpfBinW = 18000 * (_gpfBinW & 65535) + (_gpfBinW >> 16) & _gpfMax32;
        return ((_gpfBinZ << 16) + _gpfBinW & _gpfMax32) + _gpfMax31;
    }
147399
function(n){

        // Examine international prefix
        if(n.substr(0,2) === '61'){
            return n.length === 11;
        }

        // Examine international prefix
        if(n.substr(0,4) === '0061'){
            return n.length === 13;
        }

        // Examine number of digits
        return n.length === 10;
    }
1283446
private int decodeAlphanumeric( QrCode qr , PackedBits8 data, int bitLocation ) {
		int lengthBits = QrCodeEncoder.getLengthBitsAlphanumeric(qr.version);

		int length = data.read(bitLocation,lengthBits,true);
		bitLocation += lengthBits;

		while( length >= 2 ) {
			if( data.size < bitLocation+11 ) {
				qr.failureCause = QrCode.Failure.MESSAGE_OVERFLOW;
				return -1;
			}
			int chunk = data.read(bitLocation,11,true);
			bitLocation += 11;

			int valA = chunk/45;
			int valB = chunk-valA*45;

			workString.append(valueToAlphanumeric(valA));
			workString.append(valueToAlphanumeric(valB));
			length -= 2;
		}

		if( length == 1 ) {
			if( data.size < bitLocation+6 ) {
				qr.failureCause = QrCode.Failure.MESSAGE_OVERFLOW;
				return -1;
			}
			int valA = data.read(bitLocation,6,true);
			bitLocation += 6;
			workString.append(valueToAlphanumeric(valA));
		}
		return bitLocation;
	}
423228
private static String getVerifyCode(String idNumber) {
        int sum = 0;
        for (int i = 0; i < 17; i++) {
            sum = sum + Integer.parseInt(String.valueOf(idNumber.charAt(i))) * Integer.parseInt(Wi[i]);
        }
        return ValCodeArr[sum % 11];
    }
1338478
private function isNanpaNumberWithNationalPrefix()
    {
        // For NANPA numbers beginning with 1[2-9], treat the 1 as the national prefix. The reason is
        // that national significant numbers in NANPA always start with [2-9] after the national prefix.
        // Numbers beginning with 1[01] can only be short/emergency numbers, which don't need the
        // national prefix.
        return ($this->currentMetadata->getCountryCode() == 1) && (mb_substr($this->nationalNumber, 0, 1) == '1')
            && (mb_substr($this->nationalNumber, 1, 1) != '0') && (mb_substr($this->nationalNumber, 1, 1) != '1');
    }
1253129
public function SecureRandomNumber()
    {
        $this->openSSLCheck();

        $cstrong = false;
        $secure_random_number = '';

        while (strlen($secure_random_number) < 78) {
            $secure_random_number = $secure_random_number . hexdec(bin2hex(openssl_random_pseudo_bytes(4, $cstrong)));
        }

        if ($secure_random_number === false || $cstrong === false) {
            throw new \Exception('The Phactor math library could not generate a cryptographically-strong random number. Your OpenSSL extension might be old or broken. Please contact your web hosting provider with this error message.');
        }

        return $secure_random_number;
    }
551223
public static function IdGenerate($nums = 8)
    {
        /**
         * @var string
         */
        $idCharSet = "QWERTYUIOPASDFGHJKLZXCVBNM0123456789";

        $id = [];
        $idCharSetArray = str_split($idCharSet);
        $charArrayCount = count($idCharSetArray) - 1;

        for ($i = 0; $i < $nums; $i++) {
            $id[$i] = $idCharSetArray[random_int(0, $charArrayCount)];
        }

        $id = implode("", $id);

        return $id;
    }
1271228
private String buildIdentifier() {
    checkForEmptyIdentifier();
    CharType boundary = nearestCharType(CharType.DOT, CharType.EOL);
    if (chars.positiveLookaheadBefore(boundary, CharType.LETTER, CharType.HYPHEN)) {
      return alphanumericIdentifier();
    } else {
      return digits();
    }
  }
1077741
private String preReleaseIdentifier() {
        checkForEmptyIdentifier();
        CharType boundary = nearestCharType(DOT, PLUS, EOI);
        if (chars.positiveLookaheadBefore(boundary, LETTER, HYPHEN)) {
            return alphanumericIdentifier();
        } else {
            return numericIdentifier();
        }
    }