Skip to contents

Generate version 4 (pseudo-random) Universally Unique Identifiers (UUIDs).

Usage

generate_uuid(hint = NULL)

Source

Heavily based on an unreleased version of ids::uuid().

Arguments

hint

Optional. A character string (or object coercible with as.character()) to be used as a random seed.

Value

A character string representing a valid UUID that can be validated with uuid::UUIDvalidate().

Details

This helper function assigns a UUID for identifying versions of generated themes.

References

Davis KR, Peabody B, Leach P (2024). "Universally Unique IDentifiers (UUIDs)." RFC 9562. doi:10.17487/RFC9562 , https://www.rfc-editor.org/info/rfc9562.

See also

Other helpers: on_rstudio()

Examples

# Random
generate_uuid()
#> [1] "9ec3e5c8-c404-4e17-8e4c-81bd36aa3d2a"

generate_uuid()
#> [1] "04d42bbc-2145-4ebe-83ef-a1a2d8d52a86"

# Persistent with hint param

hint <- "something as seed"

generate_uuid(hint)
#> [1] "736f6d65-7468-496e-a720-617320736565"

generate_uuid(hint)
#> [1] "736f6d65-7468-496e-a720-617320736565"