Generate v4 (random) or v7 (time-ordered — sorts naturally, a common choice for database primary keys) UUIDs, one at a time or in bulk.
Generated with crypto.getRandomValues() · nothing leaves your browsercrypto.getRandomValues(), the browser's cryptographically secure random source — not Math.random().