MCPcopy Create free account
hub / github.com/Azure/azure-storage-python / get_random_bytes

Method get_random_bytes

tests/testcase.py:102–111  ·  view source on GitHub ↗
(self, size)

Source from the content-addressed store, hash-verified

100 return name
101
102 def get_random_bytes(self, size):
103 if self.test_mode.lower() == TestMode.run_live_no_record.lower():
104 rand = random.Random()
105 else:
106 checksum = zlib.adler32(self.qualified_test_name.encode()) & 0xffffffff
107 rand = random.Random(checksum)
108 result = bytearray(size)
109 for i in range(size):
110 result[i] = int(rand.random()*255) # random() is consistent between python 2 and 3
111 return bytes(result)
112
113 def get_random_text_data(self, size):
114 '''Returns random unicode text data exceeding the size threshold for

Calls

no outgoing calls

Tested by

no test coverage detected