Skip to content

Random String

The random_string function generates a random string of letters, numbers, or special characters.

Introduced in FalconPy v1.5.1.

KeywordData typeDefaultAllowed values
lengthInteger10Any (performance impacted by very long strings)
include_lettersBooleanTrueTrue or False
include_digitsBooleanTrueTrue or False
include_specialsBooleanFalseTrue or False

Default (10 characters, mixed-case letters and numbers):

from falconpy import random_string
result = random_string()
print(result)
lqp7iGsob0

Custom length:

from falconpy import random_string
result = random_string(length=25)
print(result)
LOtxDgHV9z0OblG1wOykSFgLm

Numbers only:

from falconpy import random_string
result = random_string(include_letters=False)
6759739861

With special characters:

from falconpy import random_string
result = random_string(length=25, include_specials=True)
0h&OLSUofllhtUwbZdwu@BymF