def randrange_fmt(mode, char, obj):
 x = randrange(*fmtdict[mode][char])
 if (char == 'c'):
  x = bytes(chr(x), 'latin1')
 if (char == '?'):
  x = bool(x)
 if ((char == 'f') or (char == 'd')):
  x = struct.pack(char, x)
  x = struct.unpack(char, x)[0]
 if ((obj == 'numpy') and (x == '\x00')):
  x = '\x01'
 return x

def randrange_fmt ( mode , char , obj ) : x = randrange ( * fmtdict [ mode ] [ char ] ) if ( char == 'c' ) : x = bytes ( chr ( x ) , 'latin1' ) if ( char == '?' ) : x = bool ( x ) if ( ( char == 'f' ) or ( char == 'd' ) ) : x = struct . pack ( char , x ) x = struct . unpack ( char , x ) [ 0 ] if ( ( obj == 'numpy' ) and ( x == '\x00' ) ) : x = '\x01' return x
return random item for a type specified by a mode and a single format character .