Random ID Generator
NodeJS
Easy
3 views
Problem Description
Generate a random id for meetcode logs using crypto.
Output Format
Print one line.
Constraints
Prefer crypto.randomUUID when available.
Official Solution
const crypto = require('crypto');
const id = typeof crypto.randomUUID === 'function'
? crypto.randomUUID()
: crypto.randomBytes(16).toString('hex');
console.log('meetcode-' + id);
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!