Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

std.uuid

UUID v4 generation.

import std.uuid

Functions

generate

uuid.generate() string

Returns a random UUID v4 string in standard format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.

let id = uuid.generate()
// e.g. "a3b4c5d6-1234-4abc-9def-0123456789ab"

Example

import std.uuid

fn main() {
    let id1 = uuid.generate()
    let id2 = uuid.generate()
    print(f"ID 1: {id1}")
    print(f"ID 2: {id2}")
}