We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a40d03a commit e937629Copy full SHA for e937629
rng.js
@@ -1,13 +1,15 @@
1
// Original code adapted from Robert Kieffer.
2
// details at https://github.com/broofa/node-uuid
3
+
4
5
(function() {
6
var _global = this;
7
8
var mathRNG, whatwgRNG;
9
10
// NOTE: Math.random() does not guarantee "cryptographic quality"
11
mathRNG = function(size) {
- var bytes = new Array(size);
12
+ var bytes = new Buffer(size);
13
var r;
14
15
for (var i = 0, r; i < size; i++) {
@@ -20,7 +22,7 @@
20
22
21
23
if (_global.crypto && crypto.getRandomValues) {
24
whatwgRNG = function(size) {
- var bytes = new Uint8Array(size);
25
+ var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array
26
crypto.getRandomValues(bytes);
27
return bytes;
28
}
0 commit comments