Socket
Socket
Sign inDemoInstall

seedrandom

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seedrandom - npm Package Compare versions

Comparing version 2.3.11 to 2.4.0

index.js

2

component.json
{
"name": "seedrandom",
"version": "2.3.11",
"version": "2.4.0",
"description": "Seeded random number generator for Javascript",

@@ -5,0 +5,0 @@ "repository": "davidbau/seedrandom",

@@ -24,3 +24,8 @@ module.exports = function(grunt) {

files: {
"<%= pkg.name %>.min.js": [ "<%= pkg.name %>.js" ]
"<%= pkg.name %>.min.js": [ "<%= pkg.name %>.js" ],
"lib/tychei.min.js": [ "lib/tychei.js" ],
"lib/xor4096.min.js": [ "lib/xor4096.js" ],
"lib/xorshift7.min.js": [ "lib/xorshift7.js" ],
"lib/xorwow.min.js": [ "lib/xorwow.js" ],
"lib/xor128.min.js": [ "lib/xor128.js" ]
},

@@ -51,3 +56,3 @@ options: {

options: {
files: ['test/cryptotest.js', 'test/nodetest.js']
files: ['test/cryptotest.js', 'test/nodetest.js', 'test/prngtest.js']
},

@@ -54,0 +59,0 @@ coverage: {

{
"name": "seedrandom",
"version": "2.3.11",
"version": "2.4.0",
"description": "Seeded random number generator for Javascript.",
"main": "seedrandom.js",
"main": "index.js",
"keywords": [

@@ -27,3 +28,8 @@ "random",

"pattern": [
"seedrandom.js"
"seedrandom.js",
"lib/xor128.js",
"lib/xorwow.js",
"lib/xorshift7.js",
"lib/tychei.js",
"lib/xor4096.js"
]

@@ -37,3 +43,3 @@ }

"grunt-cli": "latest",
"grunt-contrib-qunit": "git://github.com/gruntjs/grunt-contrib-qunit.git#master",
"grunt-contrib-qunit": "<=0.5.2",
"grunt-contrib-uglify": "latest",

@@ -44,5 +50,5 @@ "grunt-mocha-cov": "latest",

"phantomjs": "latest",
"proxyquire": "git://github.com/davidbau/proxyquire.git#nullstub",
"proxyquire": "latest",
"requirejs": "latest"
}
}

@@ -7,20 +7,22 @@ seedrandom.js

Seeded random number generator for Javascript.
Seeded random number generator for JavaScript.
version 2.3.11<br>
Author: David Bau<br>
Date: 2014 Dec 11
Version 2.4.0
Can be used as a plain script, a node.js module or an AMD module.
Author: David Bau
Date: 2015-05-02
Can be used as a plain script, a Node.js module or an AMD module.
Script tag usage
----------------
<pre>
&lt;script src=//cdnjs.cloudflare.com/ajax/libs/seedrandom/2.3.11/seedrandom.min.js&gt;
&lt;/script&gt;
</pre>
```html
<script src="//cdnjs.cloudflare.com/ajax/libs/seedrandom/2.4.0/seedrandom.min.js">
</script>
```
<pre>
```js
// Sets Math.random to a PRNG initialized using the given explicit seed.

@@ -44,13 +46,61 @@ Math.seedrandom('hello.');

console.log(myrng()); // Always 0.9282578795792454
</pre>
// Use "quick" to get only 32 bits of randomness in a float.
console.log(myrng.quick()); // Always 0.3752569768112153
// Use "int32" to get a 32 bit (signed) integer
console.log(myrng.int32()); // Always 986220731
```
Other Fast PRNG Algorithms
--------------------------
The package includes some other fast PRNGs. To use Richard Brent's
xorgens-4096 PRNG:
```html
<script src="//cdnjs.cloudflare.com/ajax/libs/seedrandom/2.4.0/lib/xor4096.min.js">
</script>
```
```js
// Use xor4096 for Richard Brent's xorgens-4096 algorithm.
var xorgen = new xor4096('hello.');
// By default provides 32 bits of randomness in a float.
console.log(xorgen()); //
// Use "double" to get 56 bits of randomness.
console.log(xorgen.double()); //
// Use "int32" to get a 32 bit (signed) integer.
console.log(xorgen.int32()); //
````
Besides xor4096, there are several other faster PRNGs available.
|PRNG name | Time vs native | Period | Author |
|-----------|----------------|-------------|----------------------|
|`xor128` | 5.30 ns, 1.3x | 2^128-1 | Marsaglia |
|`xorwow` | 5.65 ns, 1.4x | 2^192-2^32 | Marsaglia |
|`xorshift7`| 6.70 ns, 1.6x | 2^256-1 | Panneton/L'ecuyer |
|`tychei` | 11.35 ns, 2.8x | ~2^127 | Neves/Araujo (ChaCha)|
|`quick` | 12.20 ns, 3.0x | ~2^1600 | Bau (ARC4) |
|`xor4096` | 20.70 ns, 5.0x | 2^4096-2^32 | Brent (xorgens) |
(`quick` is just the 32-bit version of the RC4-based PRNG
originally packaged with seedrandom.)
Node.js usage
-------------
<pre>
```
npm install seedrandom
</pre>
```
<pre>
```js
// Local PRNG: does not affect Math.random.

@@ -72,15 +122,19 @@ var seedrandom = require('seedrandom');

console.log(rng()); // As unpredictable as added entropy.
</pre>
// Using alternate algorithms, as listed above.
var rng2 = seedrandom.xor4096('hello.')
console.log(rng2());
```
Require.js usage
----------------
Similar to node.js usage:
Similar to Node.js usage:
<pre>
```
bower install seedrandom
</pre>
```
<pre>
```
require(['seedrandom'], function(seedrandom) {

@@ -90,3 +144,3 @@ var rng = seedrandom('hello.');

});
</pre>
```

@@ -97,11 +151,11 @@

<pre>
&lt;script src=//cdnjs.cloudflare.com/ajax/libs/seedrandom/2.3.11/seedrandom.min.js&gt;
&lt;/script&gt;
&lt;!-- Seeds using urandom bits from a server. --&gt;
&lt;script src=//jsonlib.appspot.com/urandom?callback=Math.seedrandom"&gt;
&lt;/script&gt;
```html
<script src=//cdnjs.cloudflare.com/ajax/libs/seedrandom/2.4.0/seedrandom.min.js>
</script>
<!-- Seeds using urandom bits from a server. -->
<script src=//jsonlib.appspot.com/urandom?callback=Math.seedrandom>
</script>
&lt;!-- Seeds mixing in random.org bits --&gt;
&lt;script&gt;
<!-- Seeds mixing in random.org bits -->
<script>
(function(x, u, s){

@@ -119,4 +173,4 @@ try {

'?num=256&min=0&max=255&col=1&base=16&format=plain&rnd=new');
&lt;/script&gt;
</pre>
</script>
```

@@ -126,3 +180,3 @@ Reseeding using user input

<pre>
```js
var seed = Math.seedrandom(); // Use prng with an automatic seed.

@@ -138,3 +192,3 @@ document.write(Math.random()); // Pretty much unpredictable x.

t.push([e.pageX, e.pageY, +new Date]);
if (t.length &lt; count) { return; }
if (t.length < count) { return; }
document.removeEventListener(event, w);

@@ -146,3 +200,3 @@ Math.seedrandom(t, { entropy: true });

reseed('mousemove', 100); // Reseed after 100 mouse moves.
</pre>
```

@@ -153,7 +207,7 @@ The "pass" option can be used to get both the prng and the seed.

<pre>
```js
var obj = Math.seedrandom(null, { pass: function(prng, seed) {
return { random: prng, seed: seed };
}});
</pre>
```

@@ -164,10 +218,10 @@

<pre>
```js
var seedrandom = Math.seedrandom;
var saveable = seedrandom("secret-seed", {state: true});
for (var j = 0; j &lt; 1e5; ++j) saveable();
for (var j = 0; j < 1e5; ++j) saveable();
var saved = saveable.state();
var replica = seedrandom("", {state: saved});
assert(replica() == saveable());
</pre>
```

@@ -194,2 +248,3 @@ In normal use the prng is opaque and its internal state cannot be accessed.

* Version 2.3.11 adds an option to load and save internal state.
* Version 2.4.0 adds implementations of several other fast PRNGs.

@@ -223,3 +278,3 @@ The standard ARC4 key scheduler cycles short keys, which means that

Autoseeding without crypto is somewhat slower, about 20-30 milliseconds on
Autoseeding without crypto is somewhat slow, about 20-30 milliseconds on
a 2012 windows 7 1.5ghz i5 laptop, as seen on Firefox 19, IE 10, and Opera.

@@ -233,3 +288,3 @@ Seeded rng calls themselves are fast across these browsers, with slowest

Copyright 2014 David Bau.
Copyright 2015 David Bau.

@@ -236,0 +291,0 @@ Permission is hereby granted, free of charge, to any person obtaining

@@ -1,198 +0,2 @@

/**
seedrandom.js
=============
Seeded random number generator for Javascript.
version 2.3.11
Author: David Bau
Date: 2014 Dec 11
Can be used as a plain script, a node.js module or an AMD module.
Script tag usage
----------------
<script src=//cdnjs.cloudflare.com/ajax/libs/seedrandom/2.3.11/seedrandom.min.js>
</script>
// Sets Math.random to a PRNG initialized using the given explicit seed.
Math.seedrandom('hello.');
console.log(Math.random()); // Always 0.9282578795792454
console.log(Math.random()); // Always 0.3752569768646784
// Sets Math.random to an ARC4-based PRNG that is autoseeded using the
// current time, dom state, and other accumulated local entropy.
// The generated seed string is returned.
Math.seedrandom();
console.log(Math.random()); // Reasonably unpredictable.
// Seeds using the given explicit seed mixed with accumulated entropy.
Math.seedrandom('added entropy.', { entropy: true });
console.log(Math.random()); // As unpredictable as added entropy.
// Use "new" to create a local prng without altering Math.random.
var myrng = new Math.seedrandom('hello.');
console.log(myrng()); // Always 0.9282578795792454
Node.js usage
-------------
npm install seedrandom
// Local PRNG: does not affect Math.random.
var seedrandom = require('seedrandom');
var rng = seedrandom('hello.');
console.log(rng()); // Always 0.9282578795792454
// Autoseeded ARC4-based PRNG.
rng = seedrandom();
console.log(rng()); // Reasonably unpredictable.
// Global PRNG: set Math.random.
seedrandom('hello.', { global: true });
console.log(Math.random()); // Always 0.9282578795792454
// Mixing accumulated entropy.
rng = seedrandom('added entropy.', { entropy: true });
console.log(rng()); // As unpredictable as added entropy.
Require.js usage
----------------
Similar to node.js usage:
bower install seedrandom
require(['seedrandom'], function(seedrandom) {
var rng = seedrandom('hello.');
console.log(rng()); // Always 0.9282578795792454
});
Network seeding
---------------
<script src=//cdnjs.cloudflare.com/ajax/libs/seedrandom/2.3.11/seedrandom.min.js>
</script>
<!-- Seeds using urandom bits from a server. -->
<script src=//jsonlib.appspot.com/urandom?callback=Math.seedrandom">
</script>
<!-- Seeds mixing in random.org bits -->
<script>
(function(x, u, s){
try {
// Make a synchronous request to random.org.
x.open('GET', u, false);
x.send();
s = unescape(x.response.trim().replace(/^|\s/g, '%'));
} finally {
// Seed with the response, or autoseed on failure.
Math.seedrandom(s, !!s);
}
})(new XMLHttpRequest, 'https://www.random.org/integers/' +
'?num=256&min=0&max=255&col=1&base=16&format=plain&rnd=new');
</script>
Reseeding using user input
--------------------------
var seed = Math.seedrandom(); // Use prng with an automatic seed.
document.write(Math.random()); // Pretty much unpredictable x.
var rng = new Math.seedrandom(seed); // A new prng with the same seed.
document.write(rng()); // Repeat the 'unpredictable' x.
function reseed(event, count) { // Define a custom entropy collector.
var t = [];
function w(e) {
t.push([e.pageX, e.pageY, +new Date]);
if (t.length &lt; count) { return; }
document.removeEventListener(event, w);
Math.seedrandom(t, { entropy: true });
}
document.addEventListener(event, w);
}
reseed('mousemove', 100); // Reseed after 100 mouse moves.
The "pass" option can be used to get both the prng and the seed.
The following returns both an autoseeded prng and the seed as an object,
without mutating Math.random:
var obj = Math.seedrandom(null, { pass: function(prng, seed) {
return { random: prng, seed: seed };
}});
Saving and Restoring PRNG state
-------------------------------
var seedrandom = Math.seedrandom;
var saveable = seedrandom("secret-seed", {state: true});
for (var j = 0; j < 1e5; ++j) saveable();
var saved = saveable.state();
var replica = seedrandom("", {state: saved});
assert(replica() == saveable());
In normal use the prng is opaque and its internal state cannot be accessed.
However, if the "state" option is specified, the prng gets a state() method
that returns a plain object the can be used to reconstruct a prng later in
the same state (by passing that saved object back as the state option).
Version notes
-------------
The random number sequence is the same as version 1.0 for string seeds.
* Version 2.0 changed the sequence for non-string seeds.
* Version 2.1 speeds seeding and uses window.crypto to autoseed if present.
* Version 2.2 alters non-crypto autoseeding to sweep up entropy from plugins.
* Version 2.3 adds support for "new", module loading, and a null seed arg.
* Version 2.3.1 adds a build environment, module packaging, and tests.
* Version 2.3.4 fixes bugs on IE8, and switches to MIT license.
* Version 2.3.6 adds a readable options object argument.
* Version 2.3.10 adds support for node.js crypto (contributed by ctd1500).
* Version 2.3.11 adds an option to load and save internal state.
The standard ARC4 key scheduler cycles short keys, which means that
seedrandom('ab') is equivalent to seedrandom('abab') and 'ababab'.
Therefore it is a good idea to add a terminator to avoid trivial
equivalences on short string seeds, e.g., Math.seedrandom(str + '\0').
Starting with version 2.0, a terminator is added automatically for
non-string seeds, so seeding with the number 111 is the same as seeding
with '111\0'.
When seedrandom() is called with zero args or a null seed, it uses a
seed drawn from the browser crypto object if present. If there is no
crypto support, seedrandom() uses the current time, the native rng,
and a walk of several DOM objects to collect a few bits of entropy.
Each time the one- or two-argument forms of seedrandom are called,
entropy from the passed seed is accumulated in a pool to help generate
future seeds for the zero- and two-argument forms of seedrandom.
On speed - This javascript implementation of Math.random() is several
times slower than the built-in Math.random() because it is not native
code, but that is typically fast enough. Some details (timings on
Chrome 25 on a 2010 vintage macbook):
* seeded Math.random() - avg less than 0.0002 milliseconds per call
* seedrandom('explicit.') - avg less than 0.2 milliseconds per call
* seedrandom('explicit.', true) - avg less than 0.2 milliseconds per call
* seedrandom() with crypto - avg less than 0.2 milliseconds per call
Autoseeding without crypto is somewhat slower, about 20-30 milliseconds on
a 2012 windows 7 1.5ghz i5 laptop, as seen on Firefox 19, IE 10, and Opera.
Seeded rng calls themselves are fast across these browsers, with slowest
numbers on Opera at about 0.0005 ms per seeded Math.random().
LICENSE (MIT)
-------------
/*
Copyright 2014 David Bau.

@@ -221,16 +25,16 @@

/**
* All code is in an anonymous closure to keep the global namespace clean.
*/
(function (
global, pool, math, width, chunks, digits, module, define, rngname) {
(function (pool, math) {
//
// The following constants are related to IEEE 754 limits.
//
var startdenom = math.pow(width, chunks),
var global = this,
width = 256, // each RC4 output is 0 <= x < 256
chunks = 6, // at least six RC4 outputs for each double
digits = 52, // there are 52 significant digits in a double
rngname = 'random', // rngname: name for Math.random and Math.seedrandom
startdenom = math.pow(width, chunks),
significance = math.pow(2, digits),
overflow = significance * 2,
mask = width - 1,
nodecrypto;
nodecrypto; // node.js crypto module, initialized at the bottom.

@@ -241,3 +45,3 @@ //

//
var impl = math['seed' + rngname] = function(seed, options, callback) {
function seedrandom(seed, options, callback) {
var key = [];

@@ -254,2 +58,25 @@ options = (options == true) ? { entropy: true } : (options || {});

// This function returns a random double in [0, 1) that contains
// randomness in every bit of the mantissa of the IEEE 754 value.
var prng = function() {
var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
d = startdenom, // and denominator d = 2 ^ 48.
x = 0; // and no 'extra last byte'.
while (n < significance) { // Fill up all significant digits by
n = (n + x) * width; // shifting numerator and
d *= width; // denominator and generating a
x = arc4.g(1); // new least-significant-byte.
}
while (n >= overflow) { // To avoid rounding up, before adding
n /= 2; // last byte, shift everything
d /= 2; // right using integer math until
x >>>= 1; // we have exactly the desired bits.
}
return (n + x) / d; // Form the number within [0, 1).
};
prng.int32 = function() { return arc4.g(4) | 0; }
prng.quick = function() { return arc4.g(4) / ((1 << 30) * 4); }
prng.double = prng;
// Mix the randomness into accumulated entropy.

@@ -276,25 +103,8 @@ mixkey(tostring(arc4.S), pool);

})(
// This function returns a random double in [0, 1) that contains
// randomness in every bit of the mantissa of the IEEE 754 value.
function() {
var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
d = startdenom, // and denominator d = 2 ^ 48.
x = 0; // and no 'extra last byte'.
while (n < significance) { // Fill up all significant digits by
n = (n + x) * width; // shifting numerator and
d *= width; // denominator and generating a
x = arc4.g(1); // new least-significant-byte.
}
while (n >= overflow) { // To avoid rounding up, before adding
n /= 2; // last byte, shift everything
d /= 2; // right using integer math until
x >>>= 1; // we have exactly the desired bits.
}
return (n + x) / d; // Form the number within [0, 1).
},
prng,
shortseed,
'global' in options ? options.global : (this == math),
options.state);
};
}
math['seed' + rngname] = seedrandom;

@@ -311,3 +121,2 @@ //

//
/** @constructor */
function ARC4(key) {

@@ -387,13 +196,15 @@ var t, keylen = key.length,

// autoseed()
// Returns an object for autoseeding, using window.crypto if available.
// Returns an object for autoseeding, using window.crypto and Node crypto
// module if available.
//
/** @param {Uint8Array|Navigator=} seed */
function autoseed(seed) {
function autoseed() {
try {
if (nodecrypto) return tostring(nodecrypto.randomBytes(width));
global.crypto.getRandomValues(seed = new Uint8Array(width));
return tostring(seed);
if (nodecrypto) { return tostring(nodecrypto.randomBytes(width)); }
var out = new Uint8Array(width);
(global.crypto || global.msCrypto).getRandomValues(out);
return tostring(out);
} catch (e) {
return [+new Date, global, (seed = global.navigator) && seed.plugins,
global.screen, tostring(pool)];
var browser = global.navigator,
plugins = browser && browser.plugins;
return [+new Date, global, plugins, global.screen, tostring(pool)];
}

@@ -417,3 +228,3 @@ }

//
mixkey(math[rngname](), pool);
mixkey(math.random(), pool);

@@ -424,27 +235,16 @@ //

//
if (module && module.exports) {
module.exports = impl;
if ((typeof module) == 'object' && module.exports) {
module.exports = seedrandom;
// When in node.js, try using crypto package for autoseeding.
try {
// When in node.js, try using crypto package for autoseeding.
nodecrypto = require('crypto');
} catch (ex) {}
} else if (define && define.amd) {
define(function() { return impl; });
} else if ((typeof define) == 'function' && define.amd) {
define(function() { return seedrandom; });
}
//
// Node.js native crypto support.
//
// End anonymous scope, and pass initial values.
})(
this, // global window object
[], // pool: entropy pool starts empty
Math, // math: package containing random, pow, and seedrandom
256, // width: each RC4 output is 0 <= x < 256
6, // chunks: at least six RC4 outputs for each double
52, // digits: there are 52 significant digits in a double
(typeof module) == 'object' && module, // present in node.js
(typeof define) == 'function' && define, // present with an AMD loader
'random'// rngname: name for Math.random and Math.seedrandom
Math // math: package containing random, pow, and seedrandom
);

@@ -1,1 +0,1 @@

!function(a,b,c,d,e,f,g,h,i){function j(a){var b,c=a.length,e=this,f=0,g=e.i=e.j=0,h=e.S=[];for(c||(a=[c++]);d>f;)h[f]=f++;for(f=0;d>f;f++)h[f]=h[g=t&g+a[f%c]+(b=h[f])],h[g]=b;(e.g=function(a){for(var b,c=0,f=e.i,g=e.j,h=e.S;a--;)b=h[f=t&f+1],c=c*d+h[t&(h[f]=h[g=t&g+b])+(h[g]=b)];return e.i=f,e.j=g,c})(d)}function k(a,b){return b.i=a.i,b.j=a.j,b.S=a.S.slice(),b}function l(a,b){var c,d=[],e=typeof a;if(b&&"object"==e)for(c in a)try{d.push(l(a[c],b-1))}catch(f){}return d.length?d:"string"==e?a:a+"\0"}function m(a,b){for(var c,d=a+"",e=0;e<d.length;)b[t&e]=t&(c^=19*b[t&e])+d.charCodeAt(e++);return o(b)}function n(c){try{return p?o(p.randomBytes(d)):(a.crypto.getRandomValues(c=new Uint8Array(d)),o(c))}catch(e){return[+new Date,a,(c=a.navigator)&&c.plugins,a.screen,o(b)]}}function o(a){return String.fromCharCode.apply(0,a)}var p,q=c.pow(d,e),r=c.pow(2,f),s=2*r,t=d-1,u=c["seed"+i]=function(a,f,g){var h=[];f=1==f?{entropy:!0}:f||{};var p=m(l(f.entropy?[a,o(b)]:null==a?n():a,3),h),t=new j(h);return m(o(t.S),b),(f.pass||g||function(a,b,d,e){return e&&(e.S&&k(e,t),a.state=function(){return k(t,{})}),d?(c[i]=a,b):a})(function(){for(var a=t.g(e),b=q,c=0;r>a;)a=(a+c)*d,b*=d,c=t.g(1);for(;a>=s;)a/=2,b/=2,c>>>=1;return(a+c)/b},p,"global"in f?f.global:this==c,f.state)};if(m(c[i](),b),g&&g.exports){g.exports=u;try{p=require("crypto")}catch(v){}}else h&&h.amd&&h(function(){return u})}(this,[],Math,256,6,52,"object"==typeof module&&module,"function"==typeof define&&define,"random");
!function(a,b){function c(c,j,k){var n=[];j=1==j?{entropy:!0}:j||{};var s=g(f(j.entropy?[c,i(a)]:null==c?h():c,3),n),t=new d(n),u=function(){for(var a=t.g(m),b=p,c=0;q>a;)a=(a+c)*l,b*=l,c=t.g(1);for(;a>=r;)a/=2,b/=2,c>>>=1;return(a+c)/b};return u.int32=function(){return 0|t.g(4)},u.quick=function(){return t.g(4)/(4*(1<<30))},u["double"]=u,g(i(t.S),a),(j.pass||k||function(a,c,d,f){return f&&(f.S&&e(f,t),a.state=function(){return e(t,{})}),d?(b[o]=a,c):a})(u,s,"global"in j?j.global:this==b,j.state)}function d(a){var b,c=a.length,d=this,e=0,f=d.i=d.j=0,g=d.S=[];for(c||(a=[c++]);l>e;)g[e]=e++;for(e=0;l>e;e++)g[e]=g[f=s&f+a[e%c]+(b=g[e])],g[f]=b;(d.g=function(a){for(var b,c=0,e=d.i,f=d.j,g=d.S;a--;)b=g[e=s&e+1],c=c*l+g[s&(g[e]=g[f=s&f+b])+(g[f]=b)];return d.i=e,d.j=f,c})(l)}function e(a,b){return b.i=a.i,b.j=a.j,b.S=a.S.slice(),b}function f(a,b){var c,d=[],e=typeof a;if(b&&"object"==e)for(c in a)try{d.push(f(a[c],b-1))}catch(g){}return d.length?d:"string"==e?a:a+"\0"}function g(a,b){for(var c,d=a+"",e=0;e<d.length;)b[s&e]=s&(c^=19*b[s&e])+d.charCodeAt(e++);return i(b)}function h(){try{if(j)return i(j.randomBytes(l));var b=new Uint8Array(l);return(k.crypto||k.msCrypto).getRandomValues(b),i(b)}catch(c){var d=k.navigator,e=d&&d.plugins;return[+new Date,k,e,k.screen,i(a)]}}function i(a){return String.fromCharCode.apply(0,a)}var j,k=this,l=256,m=6,n=52,o="random",p=b.pow(l,m),q=b.pow(2,n),r=2*q,s=l-1;if(b["seed"+o]=c,g(b.random(),a),"object"==typeof module&&module.exports){module.exports=c;try{j=require("crypto")}catch(t){}}else"function"==typeof define&&define.amd&&define(function(){return c})}([],Math);

@@ -186,3 +186,3 @@ var assert = require("assert");

for (var x in dummy) {
count += 1;
if (x == 'state') count += 1;
}

@@ -189,0 +189,0 @@ assert.equal(count, 0);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc