1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
7 | var rnds8 = new Uint8Array(16);
|
8 | export default function rng() {
|
9 | if (!getRandomValues) {
|
10 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
11 | }
|
12 |
|
13 | return getRandomValues(rnds8);
|
14 | } |
\ | No newline at end of file |