MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / random_chars

Function random_chars

computer_vision/mosaic_augmentation.py:172–181  ·  view source on GitHub ↗

Automatic generate random 32 characters. Get random string code: '7b7ad245cdff75241935e4dd860f3bad' >>> len(random_chars(32)) 32

(number_char: int)

Source from the content-addressed store, hash-verified

170
171
172def random_chars(number_char: int) -> str:
173 """
174 Automatic generate random 32 characters.
175 Get random string code: '7b7ad245cdff75241935e4dd860f3bad'
176 >>> len(random_chars(32))
177 32
178 """
179 assert number_char > 1, "The number of character should greater than 1"
180 letter_code = ascii_lowercase + digits
181 return "".join(random.choice(letter_code) for _ in range(number_char))
182
183
184if __name__ == "__main__":

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected