get_random_string
Return a securely generated random string.
def get_random_string(
length: int,
allowed_chars: string = RANDOM_STRING_CHARS
) - > string
Return a securely generated random string.
Parameters
| Name | Type | Description |
|---|---|---|
| length | int | The number of characters to include in the generated string. Each character increases the total entropy (bit length) of the result. |
| allowed_chars | string = RANDOM_STRING_CHARS | A sequence of characters to sample from when building the random string. Defaults to a set of alphanumeric characters. |
Returns
| Type | Description |
|---|---|
string | A cryptographically secure random string composed of characters from the allowed set. |