1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = rng;
|
7 |
|
8 |
|
9 |
|
10 | let getRandomValues;
|
11 | const rnds8 = new Uint8Array(16);
|
12 |
|
13 | function rng() {
|
14 |
|
15 | if (!getRandomValues) {
|
16 |
|
17 |
|
18 | getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
19 |
|
20 | if (!getRandomValues) {
|
21 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
22 | }
|
23 | }
|
24 |
|
25 | return getRandomValues(rnds8);
|
26 | } |
\ | No newline at end of file |