Skip to content
Agents tracked: 440 Downloads (7d): 202M down 19.5% GitHub stars: 10.4M Releases (7d): 607 Agent status: 1 with issuesSince last limit reset: Claude 28d · Codex 0d Updated Oct 21, 2026

uuid Examples You Can Edit and Run

5 small uuid examples written by AgentGid from the official docs, one feature each. Every one runs in your browser: change the code and see the result at once, or describe a change and let AI rewrite it. The screenshots are taken from the same code by our server, which also checks that each example starts without errors.

uuid: usage and stats 292 AI-built projects use it

Try them all in one place

import { v4 as uuidv4 } from 'uuid'

// Each call returns a new random UUID string
console.log('v4 #1:', uuidv4())
console.log('v4 #2:', uuidv4())
console.log('v4 #3:', uuidv4())

// Give every record its own id
const todos = ['Write docs', 'Ship release', 'Reply to issues'].map((title) => ({ id: uuidv4(), title }))
for (const t of todos) console.log(`todo "${t.title}" ->`, t.id)

// rng option: a function that returns 16 random bytes
const rng = () => crypto.getRandomValues(new Uint8Array(16))
console.log('with rng option:', uuidv4({ rng }))

// random option: fixed bytes always give the same UUID
const random = Uint8Array.of(
  0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
  0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
)
console.log('with fixed random bytes:', uuidv4({ random }))
console.log('string length:', uuidv4().length)
Ctrl/⌘ + Enter runs

Free for signed-in members, with a daily limit. Describe the change in plain words; the new code runs only in your browser.

Run it a few times: the plain v4() lines change, the fixed-bytes line stays 109156be-c4fb-41ea-b1b4-efe1671c5836. Code written by AgentGid [1]. How it works, with a screenshot →

Checked Oct 12, 2026: each example starts without errors in Chromium with uuid 14.0.3. Needs WebGL.

Sources

  1. uuid README (GitHub)
  2. Docs: en-US › docs › Web › API › Crypto › getRandomValues

Explanations written by AgentGid from the official docs; the numbers in brackets point here. The code marked "written by AgentGid" is ours and free to copy.

Building something with uuid? Ask AgentGid →