This function generates one or more UUIDs (Universally Unique Identifiers).
By default, it generates Version 7 UUIDs, which are time-ordered and suitable
for use cases requiring efficient indexing and sorting by creation time.
Alternatively, random Version 4 UUIDs can be generated by setting usetime = FALSE.
Usage
uuid(n = 1, uppercase = FALSE, usetime = FALSE)
Value
A character vector of UUIDs of length n.
Arguments
n
Integer. Number of UUIDs to generate. Default is 1.
uppercase
Logical. If TRUE, the generated UUIDs are returned in uppercase letters. Default is FALSE.
usetime
Logical. If TRUE, generates Version 7 UUIDs using the current timestamp.
If FALSE, generates random Version 4 UUIDs. Default is FALSE.
Details
Version 7 UUIDs: These are time-ordered UUIDs based on the current timestamp in milliseconds
since the Unix epoch (1970-01-01 00:00:00 UTC). They are ideal for scenarios requiring
chronological sorting or indexing.
Version 4 UUIDs: These are randomly generated UUIDs that do not depend on time,
ensuring uniqueness through random hexadecimal values.