main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
440 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | let getRandomValues;
|
---|
| 2 | const rnds8 = new Uint8Array(16);
|
---|
| 3 | export default function rng() {
|
---|
| 4 | if (!getRandomValues) {
|
---|
| 5 | if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
---|
| 6 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
---|
| 7 | }
|
---|
| 8 | getRandomValues = crypto.getRandomValues.bind(crypto);
|
---|
| 9 | }
|
---|
| 10 | return getRandomValues(rnds8);
|
---|
| 11 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.