source: trip-planner-front/node_modules/uuid/dist/esm-node/rng.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 323 bytes
RevLine 
[6a3a178]1import crypto from 'crypto';
2const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
3
4let poolPtr = rnds8Pool.length;
5export default function rng() {
6 if (poolPtr > rnds8Pool.length - 16) {
7 crypto.randomFillSync(rnds8Pool);
8 poolPtr = 0;
9 }
10
11 return rnds8Pool.slice(poolPtr, poolPtr += 16);
12}
Note: See TracBrowser for help on using the repository browser.