UUID generation functions allow you to generate unique UUID standard identifiers. They can be useful if you need to generate random identifiers (for example, for bot users).
The generated UUID directly depends on the parameters passed during generation — if different parameter values are passed, different identifiers will be generated.
uuid.v1Signature: uuid.v1(node string = nil, clockSeq int = nil) string
Arguments:
node — A 48-bit hexadecimal number representing the hardware address of the device.clockSeq — a 14-bit number that prevents duplicate UUIDs from being created.Result: Returns a string with the generated UUID.
uuid.v2Signature: uuid.v2(localDomain str, localIdentifier int = nil, node str = nil, clockSeq int = nil) string
Arguments:
localDomain — The local domain that will be used during generation.localIdentifier — The local identifier for the local domain.node — A 48-bit hexadecimal number representing the hardware address of the device.clockSeq — A 14-bit number that prevents duplicate UUIDs from being created.Result: Returns a string with the generated UUID.
uuid.v3Signature: uuid.v3(ns str, name str) string
Arguments:
ns – UUID namespace (must be a valid UUID).name – Name to be used for generation.Result: Returns a string with the generated UUID.
uuid.v4Signature: uuid.v4() string
Arguments: None
Result: Returns a string with the generated UUID.
uuid.v5Signature: uuid.v5(ns str, name str) string
Arguments:
ns – UUID namespace (must be a valid UUID).name – Name that will be used for generation.Result: Returns a string with the generated UUID.
uuid.v6Signature: uuid.v6(node string = nil, clockSeq int = nil) string
Arguments:
node — A 48-bit hexadecimal number representing the hardware address of the device.clockSeq — A 14-bit number that prevents duplicate UUIDs from being created.Result: Returns a string with the generated UUID.
uuid.v7Signature: uuid.v7(dt str = nil) string
Arguments:
dt — An optional string containing the date and time. If not provided, the current date and time will be used for generation.Result: Returns a string with the generated UUID.
uuid.v8Signature: uuid.v8(bytes str = nil) string
Arguments:
bytes – An octet string with a size of 16 bytes. Can be filled with 128 bits of data. When filling, keep in mind that bits 48 through 51 will be replaced with the UUID version value, and bits 64 and 65 will be replaced with the UUID variant.Result: Returns a string with the generated UUID.