We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 09c28ab + f100a81 commit 263c23aCopy full SHA for 263c23a
source/ulid.ts
@@ -52,12 +52,12 @@ export function detectPRNG(root?: any): PRNG {
52
return () => {
53
const buffer = new Uint8Array(1);
54
globalCrypto.getRandomValues(buffer);
55
- return buffer[0] / 0xff;
+ return buffer[0] / 256;
56
};
57
} else if (typeof globalCrypto?.randomBytes === "function") {
58
- return () => globalCrypto.randomBytes(1).readUInt8() / 0xff;
+ return () => globalCrypto.randomBytes(1).readUInt8() / 256;
59
} else if (crypto?.randomBytes) {
60
- return () => crypto.randomBytes(1).readUInt8() / 0xff;
+ return () => crypto.randomBytes(1).readUInt8() / 256;
61
}
62
throw new ULIDError(ULIDErrorCode.PRNGDetectFailure, "Failed to find a reliable PRNG");
63
0 commit comments