testing/clusterfuzz/common/fuzzy_types.py
def FuzzIntsInString(s):
  """Returns a string where some integers have been fuzzed with FuzzyInt."""
  def ReplaceInt(m):
    val = m.group()
    if random.getrandbits(1):  # Flip a coin to decide whether to fuzz
      return val
    if not random.getrandbits(4):  # Delete the integer 1/16th of the time
      return ""
    decimal = val.isdigit()  # Assume decimal digits means a decimal number
    n = FuzzyInt(int(val) if decimal else int(val, 16))
    return str(n) if decimal else "%x" % n
  return re.sub(r"\b[a-fA-F]*\d[0-9a-fA-F]*\b", ReplaceInt, s)
Returns a string where some integers have been fuzzed with FuzzyInt.
Returns a string where some integers have been fuzzed with FuzzyInt.
Returns a string where some integers have been fuzzed with FuzzyInt .
def FuzzIntsInString(s):
  def ReplaceInt(m):
    val = m.group()
    if random.getrandbits(1):  
      return val
    if not random.getrandbits(4):  
      return ""
    decimal = val.isdigit()  
    n = FuzzyInt(int(val) if decimal else int(val, 16))
    return str(n) if decimal else "%x" % n
  return re.sub(r"\b[a-fA-F]*\d[0-9a-fA-F]*\b", ReplaceInt, s)
def FuzzIntsInString ( s ) : def ReplaceInt ( m ) : val = m . group ( ) if random . getrandbits ( 1 ) : return val if not random . getrandbits ( 4 ) : return "" decimal = val . isdigit ( ) n = FuzzyInt ( int ( val ) if decimal else int ( val , 16 ) ) return str ( n ) if decimal else "%x" % n return re . sub ( r"\b[a-fA-F]*\d[0-9a-fA-F]*\b" , ReplaceInt , s )
Returns a string where some integers have been fuzzed with FuzzyInt.
Returns a string where some integers have been fuzzed with FuzzyInt .
"""Returns a string where some integers have been fuzzed with FuzzyInt.""" # Flip a coin to decide whether to fuzz # Delete the integer 1/16th of the time # Assume decimal digits means a decimal number
s