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

Function random_chars

computer_vision/flip_augmentation.py:114–123  ·  view source on GitHub ↗

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

(number_char: int = 32)

Source from the content-addressed store, hash-verified

112
113
114def random_chars(number_char: int = 32) -> str:
115 """
116 Automatic generate random 32 characters.
117 Get random string code: '7b7ad245cdff75241935e4dd860f3bad'
118 >>> len(random_chars(32))
119 32
120 """
121 assert number_char > 1, "The number of character should greater than 1"
122 letter_code = ascii_lowercase + digits
123 return "".join(random.choice(letter_code) for _ in range(number_char))
124
125
126if __name__ == "__main__":

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected