Skip to content

Instantly share code, notes, and snippets.

@AnandPilania
Last active March 21, 2024 13:43
Show Gist options
  • Save AnandPilania/b97b8fe32406ea8920f3b488389a4dad to your computer and use it in GitHub Desktop.
Save AnandPilania/b97b8fe32406ea8920f3b488389a4dad to your computer and use it in GitHub Desktop.
UUID Generator
const generateUUID = () =>
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
var r = Math.random() * 16 | 0;
return (c == "x" ? r : (r & 0x3 | 0x8)).toString(16);
});
$1 = generateUUID();
$2 = generateUUID();
$3 = generateUUID();
$4 = generateUUID();
$5 = generateUUID();
$6 = generateUUID();
console.table([$1, $2, $3, $4, $5, $6]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment