Skip to main content

std.uuid

std.uuid generates random UUIDs.

Reference

uuid4() // random RFC 4122 version-4 UUID string

Examples

print(std.uuid.uuid4()) // e.g. 550e8400-e29b-41d4-a716-446655440000

var ids = []
for (i : std.seq.range(3)) {
ids:insert(std.uuid.uuid4())
}
print(ids)

// use as a unique filename or key
var tmp = "/tmp/" + std.uuid.uuid4() + ".json"
std.file.write(tmp, std.json.stringify({id: std.uuid.uuid4()}))

See also

  • std.file — temp file helpers (temp) as an alternative for unique paths