We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5f07491 + 322933c commit 6166317Copy full SHA for 6166317
influent-client/influent-clientjs/src/scripts/lib/util/GUID.js
@@ -25,13 +25,14 @@ define(
25
26
guid.generateGuid = function () {
27
var result = '';
28
- for (var i = 0; i < 32; i++) {
29
- if (i === 8 || i === 12 || i === 16 || i === 20) {
30
- result = result + '-';
+ var array = new Uint8Array(16);
+ window.crypto.getRandomValues(array);
+ for (var i = 0; i < array.length; i++) {
31
+ if (i === 4 || i === 6 || i === 8 || i === 10) {
32
+ result += '-';
33
}
- result = result + Math.floor(Math.random() * 16).toString(16).toUpperCase();
34
+ result += array[i].toString(16).padStart(2, '0').toUpperCase();
35
-
36
return result;
37
};
38
0 commit comments