Resident Registration Number
 http://ko.wikipedia.org/wiki/%EC%A3%BC%EB%AF%BC%EB%93%B1%EB%A1%9D%EB%B2%88%ED%98%B8
438476
def rrn
      birth = fetch_sample([*Date.new(1970, 1, 1)..Date.new(1999, 12, 31)]).strftime('%y%d%m')
      sex = fetch_sample([1, 2])
      loc = FFaker.numerify("#{fetch_sample([*'00'..'95'])}###")
      a, b, c, d, e, f, g, h, i, j, k, l = "#{birth}#{sex}#{loc}".split(//).map(&:to_i)
      checksum = (11 - (2 * a + 3 * b + 4 * c + 5 * d + 6 * e + 7 * f + 8 * g + 9 * h + 2 * i + 3 * j + 4 * k + 5 * l) % 11) % 10
      "#{birth}-#{sex}#{loc}#{checksum}"
    end
387688
def t_NUMBER(self, t):
        '
        if re.match(r'^(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?(kb|gb|mb|tb|pb|Kb|Gb|Mb|Tb|Pb)?$',t.value):
            multiplyer = 1
            try:
                suffix = (t.value[-2:]).lower()
                if suffix in ['kb']:
                    multiplyer = 1024
                elif suffix in ['mb']:
                    multiplyer = 1024*1024
                elif suffix in ['gb']:
                    multiplyer = 1024*1024*1024
                elif suffix in ['tb']:
                    multiplyer = 1024*1024*1024*1024
                elif suffix in ['pb']:
                    multiplyer = 1024*1024*1024*1024*1024
                
                if multiplyer > 1:
                    t.value = t.value[:-2]
            except:
                pass
            
            try:
                f = float(t.value)
                try:
                    e = int(t.value)
                except ValueError:
                    e = f
                    
                if (e == f):
                    t.value = multiplyer*e
                else:
                    t.value = multiplyer*f
            except ValueError:
                _LOGGER.error("el valor %s no es un numero valido" % t.value)
                t.value = 0
        else:
            t.type = 'STRING'
            
        return t
423216
function NUM() {
        var _parser = SEQ(OPT('-'), OR('0', SEQ(RANGE('1', '9'), REPEAT(DIGIT()))), OPT(SEQ('.', REPEAT(DIGIT(), 1))), OPT(SEQ(OR('e', 'E'), OPT(OR('+', '-')), REPEAT(DIGIT(), 1))));

        return _make_alias('NUM', paka.P.NUM, _parser);
    }
464409
def registration_options(self):
        
        registration_options = {}
        rs = self.registration_model()
        for k, v in self.__dict__.items():
            if k not in DEFAULT_BASE_FIELDS + ['_state']:
                try:
                    getattr(rs, k)
                    registration_options.update({k: v})
                except AttributeError:
                    pass
        registration_identifier = registration_options.get(
            'registration_identifier')
        if registration_identifier:
            registration_options['registration_identifier'] = self.to_string(
                registration_identifier)
        return registration_options
1205757
def t_NUMBER(t):
    '
    exponents = {
            'G' : 30, 'g' : 30,
            'M' : 20, 'm' : 20,
            'K' : 10, 'k' : 10,
            }
    if t.value[-1] in exponents:
        t.value = math.ldexp(int(t.value[:-1]), exponents[t.value[-1]])
    else:
        t.value = int(t.value)
    return t
970125
def start(st_reg_number):
    """"""

    weights_second_digit = range(len(st_reg_number)-1, 1, -1)
    weights_first_digit = range(len(st_reg_number), 1, -1)
    second_digits = st_reg_number[-1:]
    number_state_registration = st_reg_number[0:len(st_reg_number) - 2]
    digits_state_registration = st_reg_number[-2:]
    sum_second_digit = 0
    sum_first_digit = 0

    if len(st_reg_number) != 8 and len(st_reg_number) != 9:
        return False

    if st_reg_number[-8] in ['0', '1', '2', '3', '4', '5', '8']:

        for i in weights_second_digit:

            sum_second_digit = sum_second_digit + i*int(st_reg_number[-i-1])

        second_digits_check = 10 - (sum_second_digit % 10)

        if sum_second_digit % 10 == 0 or sum_second_digit % 11 == 1:

            second_digits_check = '0'

        if str(second_digits_check) != second_digits:

            return False

        digit_two = number_state_registration + str(second_digits_check)

        for i in weights_first_digit:

            sum_first_digit = sum_first_digit + i*int(digit_two[-i+1])

        first_digits_check = 10 - (sum_first_digit % 10)

        if sum_first_digit % 10 == 0 or sum_first_digit % 10 == 1:
            first_digits_check = '0'

        digits_calculated = str(first_digits_check) + str(second_digits_check)

        return digits_calculated == digits_state_registration

    elif st_reg_number[-8] in ['6', '7', '9']:

        for i in weights_second_digit:

            sum_second_digit = sum_second_digit + i*int(st_reg_number[-i-1])

        second_digits_check = 11 - (sum_second_digit % 11)

        if sum_second_digit % 11 == 0 or sum_second_digit % 11 == 1:
            second_digits_check = '0'

        if str(second_digits_check) != second_digits:
            return False

        digit_two = number_state_registration + str(second_digits_check)

        for i in weights_first_digit:

            sum_first_digit = sum_first_digit + i*int(digit_two[-i+1])

        first_digits_check = 11 - (sum_first_digit % 11)

        if sum_first_digit % 11 == 0 or sum_first_digit % 11 == 1:
            first_digits_check = '0'
        digits_calculated = str(first_digits_check) + str(second_digits_check)
        return digits_calculated == digits_state_registration
1096058
private int keyColumnEnd()
  {
    int offset = 0;
    
    for (int i = 0; i < _columns.length; i++) {
      if (offset == _keyStart + _keyLength) {
        return i;
      }
      
      offset += _columns[i].length();
    }
    
    if (offset == _keyStart + _keyLength) {
      return _columns.length;
    }
    
    throw new IllegalStateException();
  }
1000358
function isTokenChar(code) {
  return code === 0x21                // '!'
    || code >= 0x23 && code <= 0x27   // '#', '$', '%', '&', '''
    || code === 0x2A                  // '*'
    || code === 0x2B                  // '+'
    || code === 0x2D                  // '-'
    || code === 0x2E                  // '.'
    || code >= 0x30 && code <= 0x39   // 0-9
    || code >= 0x41 && code <= 0x5A   // A-Z
    || code >= 0x5E && code <= 0x7A   // '^', '_', '`', a-z
    || code === 0x7C                  // '|'
    || code === 0x7E;                 // '~'
}
535720
function mkNumber(val) {
            var sign = 1;
            if (val.charAt(0) == '-') {
                sign = -1;
                val = val.substring(1);
            }
            if (Lang.NUMBER_DEC.test(val))
                return sign * parseInt(val, 10);
            else if (Lang.NUMBER_HEX.test(val))
                return sign * parseInt(val.substring(2), 16);
            else if (Lang.NUMBER_OCT.test(val))
                return sign * parseInt(val.substring(1), 8);
            else if (val === 'inf')
                return sign * Infinity;
            else if (val === 'nan')
                return NaN;
            else if (Lang.NUMBER_FLT.test(val))
                return sign * parseFloat(val);
            throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val);
        }
465761
def get_register_context(self):
        
        logging.debug("GDB getting register context")
        resp = b''
        reg_num_list = [reg.reg_num for reg in self._register_list]
        vals = self._context.read_core_registers_raw(reg_num_list)
        #print("Vals: %s" % vals)
        for reg, regValue in zip(self._register_list, vals):
            if reg.bitsize == 64:
                resp += six.b(conversion.u64_to_hex16le(regValue))
            else:
                resp += six.b(conversion.u32_to_hex8le(regValue))
            logging.debug("GDB reg: %s = 0x%X", reg.name, regValue)

        return resp
716589
def get_number(self):
        '''
        
        '''
        number = None
        start = self.get_char('0123456789.-')
        if start:
            number = start
            finish = self.get_chars('-e0123456789.')
            if finish:
                number += finish
        if any(c in number for c in '.e'):
            return float(number)
        else:
            return int(number)
622525
private String getRomanNumber(int num) {
    String roman = "";  // The roman numeral.
    int N = num;        // N represents the part of num that still has
    //   to be converted to Roman numeral representation.
    for (int i = 0; i < numbers.length; i++) {
      while (N >= numbers[i]) {
        roman += letters[i];
        N -= numbers[i];
      }
    }
    return roman;
  }
364353
function() {
					var number = '', ch, chCode;
					while(isDecimalDigit(exprICode(index))) {
						number += exprI(index++);
					}

					if(exprICode(index) === PERIOD_CODE) { // can start with a decimal marker
						number += exprI(index++);

						while(isDecimalDigit(exprICode(index))) {
							number += exprI(index++);
						}
					}

					ch = exprI(index);
					if(ch === 'e' || ch === 'E') { // exponent marker
						number += exprI(index++);
						ch = exprI(index);
						if(ch === '+' || ch === '-') { // exponent sign
							number += exprI(index++);
						}
						while(isDecimalDigit(exprICode(index))) { //exponent itself
							number += exprI(index++);
						}
						if(!isDecimalDigit(exprICode(index-1)) ) {
							throwError('Expected exponent (' + number + exprI(index) + ')', index);
						}
					}


					chCode = exprICode(index);
					// Check to make sure this isn't a variable name that start with a number (123abc)
					if(isIdentifierStart(chCode)) {
						throwError('Variable names cannot start with a number (' +
									number + exprI(index) + ')', index);
					} else if(chCode === PERIOD_CODE) {
						throwError('Unexpected period', index);
					}

					return {
						type: LITERAL,
						value: parseFloat(number),
						raw: number
					};
				}
1260552
public int getCertNum() {
        for (int i = this.certChain.length - 1; i >= 0; i--) {
            if (!this.certChain[i].getSubjectDN().equals(this.certChain[i].getIssuerDN())) {
                return i + 1;
            }
        }
        return this.certChain.length;
    }
114347
function getSignificantKladrId(kladr_id) {
    var significantKladrId = kladr_id.replace(/^(\d{2})(\d*?)(0+)$/g, '$1$2');
    var length = significantKladrId.length;
    var significantLength = -1;
    if (length <= 2) {
        significantLength = 2;
    } else if (length > 2 && length <= 5) {
        significantLength = 5;
    } else if (length > 5 && length <= 8) {
        significantLength = 8;
    } else if (length > 8 && length <= 11) {
        significantLength = 11;
    } else if (length > 11 && length <= 15) {
        significantLength = 15;
    } else if (length > 15) {
        significantLength = 19;
    }
    return text_util.padEnd(significantKladrId, significantLength, "0");
}
760611
function (number) {
            var b = number,
                output = '',
                lookup = [
                    '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
                    'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed
                ];

            if (b > 20) {
                if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) {
                    output = 'fed'; // not 30ain, 70ain or 90ain
                } else {
                    output = 'ain';
                }
            } else if (b > 0) {
                output = lookup[b];
            }

            return number + output;
        }
103846
def uk_post_code
      post_towns = %w(BM CB CV LE LI LS KT MK NE OX PL YO)
      # Can't remember any othes at the moment
      number_1  = rand(100).to_s
      number_2  = rand(100).to_s
      # Easier way to do this? 
      letters = ("AA".."ZZ").to_a.rand

      return "#{post_towns.rand}#{number_1} #{number_2}#{letters}"
    end