You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export default function generate(): string {
return "00000000-0000-4000-8000-000000000000".replace(
/[0]/g,
(): string =>
// random integer from 0 to 15 as a hex digit.
(crypto.getRandomValues(new Uint8Array(1))[0] % 16).toString(16)
);
}
takes 4 bits for variant instead (8 is hard-coded), so it can generate only 2^120 uuids instead of 2^122.
The text was updated successfully, but these errors were encountered:
…d#559)
fixesdenoland#472@iuioiua this is as simple as I got, without being too intrusive; I
personally like it; the problem was a bug regarding the state change of
the variable `isLoadingSig`, I was able to avoid it by initializing the
variable as `undefined` and bypassing it with the conditional rendering
not sure if is worth taking another look at it some other time.
Note: The simplicity of this PR does not reflect at all the time that
took me to get there — just for the record.
---------
Co-authored-by: Asher Gomez <[email protected]>
UUIDv4 includes 4 bits as version number and 2 or 3 bits as variant. This code:
takes 4 bits for variant instead (
8
is hard-coded), so it can generate only 2^120 uuids instead of 2^122.The text was updated successfully, but these errors were encountered: