Universal Unique Identifier (UUID)
Overview
This page contains recommendations for using Universal Unique Identifier (UUID).
General
Do not use UUID as a random value. UUID is a unique value, not random. There is no a way to guarantee randomness, especially for versions != 4.
Do not use UUID as a session identifier.
You can use a UUID as a unique value for objects, such as a bank card ID or upload file name.
UUID generation
You can use the google/uuid package to generate UUID values in Go.
import "github.com/google/uuid"
func GenerateNewUUIDValue() string {
return uuid.New().String()
}Use the java.util.UUID class to generate UUID values.
import java.util.UUID;
public static String generateUUIDv4() {
return UUID.randomUUID().toString();
}Use the uuid package to generate UUID values.
import { v4 as uuidv4 } from 'uuid';
uuidv4();Use the uuid package to generate UUID values.
import uuid
def generate_uuid_v4() -> str:
return str(uuid.uuid4())Last updated