New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xorshift

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xorshift - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "xorshift",
"description": "Random number generator using xorshift128+",
"version": "1.1.0",
"version": "1.1.1",
"author": "Andreas Madsen <amwebdk@gmail.com>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -94,30 +94,7 @@

*/
var CONVERTION_BUFFER = new Buffer(8);
XorShift.prototype.random = function() {
// :: t2 = randomint()
var t2 = this.randomint();
var t2U = t2[0];
var t2L = t2[1];
// :: e = UINT64_C(0x3FF) << 52
var eU = 0x3FF << (52 - 32);
var eL = 0;
// :: s = t2 >> 12
var a1 = 12;
var m1 = 0xFFFFFFFF >>> (32 - a1);
sU = t2U >>> a1;
sL = (t2L >>> a1) | ((t2U & m1) << (32 - a1));
// :: x = e | s
var xU = eU | sU;
var xL = eL | sL;
// :: double d = *((double *)&x)
CONVERTION_BUFFER.writeUInt32BE(xU, 0, true);
CONVERTION_BUFFER.writeUInt32BE(xL, 4, true);
var d = CONVERTION_BUFFER.readDoubleBE(0, true);
// :: d - 1
return d - 1;
// Math.pow(2, -32) = 2.3283064365386963e-10
// Math.pow(2, -52) = 2.220446049250313e-16
return t2[0] * 2.3283064365386963e-10 + (t2[1] >>> 12) * 2.220446049250313e-16;
};

@@ -124,0 +101,0 @@

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