MCPcopy Create free account
hub / github.com/apache/arrow / get_random_ascii

Function get_random_ascii

python/benchmarks/common.py:59–67  ·  view source on GitHub ↗

Get a random ASCII-only unicode string of size *n*.

(n, seed=42)

Source from the content-addressed store, hash-verified

57
58
59def get_random_ascii(n, seed=42):
60 """
61 Get a random ASCII-only unicode string of size *n*.
62 """
63 arr = np.frombuffer(get_random_bytes(n, seed=seed), dtype=np.int8) & 0x7f
64 result, _ = codecs.ascii_decode(arr)
65 assert isinstance(result, str)
66 assert len(result) == n
67 return result
68
69
70def _random_unicode_letters(n, seed=42):

Callers

nothing calls this directly

Calls 2

get_random_bytesFunction · 0.85
lenFunction · 0.85

Tested by

no test coverage detected