treevalue.utils.random

random_hex

treevalue.utils.random.random_hex(length: int = 32) → str[source]
Overview:

Generate random hex string.

Arguments:
  • length (int): Length of hex string, default is 32.

Returns:
  • string (str): Generated string.

Examples:
>>> random_hex()  # 'ca7f14b25aa4498efdacb54e9ff72784'

random_hex_with_timestamp

treevalue.utils.random.random_hex_with_timestamp(length: int = 12) → str[source]
Overview:

Generate random hex string, with prefix of timestamp.

Arguments:
  • length (int): Length of hex string, default is 12.

Returns:
  • string (str): Generated string.

Examples:
>>> random_hex_with_timestamp()  # '20210729_202059576266_69603d64afad'