{"_id":"xorshift","_rev":"15-e8f7421138ebe4018ea58a70d63d293e","name":"xorshift","description":"Random number generator using xorshift128+","dist-tags":{"latest":"1.2.0"},"versions":{"0.1.0":{"name":"xorshift","description":"Random number generator using xorshift","version":"0.1.0","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./xorshift.js","scripts":{"test":"tap test.js"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"keywords":["random","rng","xorshift"],"devDependencies":{"tap":"0.4.x"},"license":"MIT","gitHead":"ee76b010e3243405790d59c38416349378dd6ea4","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"homepage":"https://github.com/AndreasMadsen/xorshift","_id":"xorshift@0.1.0","_shasum":"3a5a82780d1cfca40d24e57577e6a0c0861d2de9","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"dist":{"shasum":"3a5a82780d1cfca40d24e57577e6a0c0861d2de9","tarball":"https://registry.npmjs.org/xorshift/-/xorshift-0.1.0.tgz","integrity":"sha512-oFsyzLvFe+MsgeTGLjLREsdnAx5W7JwXIw+WetisKxioMOb/HKPZaoUtHpcDBTwLtbGtwMMGq5EdMkR0eOzp7g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCM8E+vyThU3wqw/tTW4/+EI88WFzm80i+tABYcMs91sAIhAK8E52CZ5avFU7/2rTmRgNzXOkZim93N+d0en1TCS/ax"}]},"directories":{}},"0.2.0":{"name":"xorshift","description":"Random number generator using xorshift128+","version":"0.2.0","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"main":"./xorshift.js","scripts":{"test":"tap test.js","benchmark":"node ./benchmark.js"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"keywords":["random","rng","xorshift"],"devDependencies":{"tap":"0.4.x"},"license":"MIT","gitHead":"9063622a4c2150004e70cb4eeeea0d8a20704a7d","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"homepage":"https://github.com/AndreasMadsen/xorshift","_id":"xorshift@0.2.0","_shasum":"9725e6bacca7fb9e96ad9dfd5be05174db1ebb2a","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"dist":{"shasum":"9725e6bacca7fb9e96ad9dfd5be05174db1ebb2a","tarball":"https://registry.npmjs.org/xorshift/-/xorshift-0.2.0.tgz","integrity":"sha512-rOeb1UtOoFxQ86YnRzCvYfTP47/dEXoL2/THkmKmP4Q9+d/fZ3GJV4zh4BKCO9l2ruJs0bPdcbjuDnxFTvUIlw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGEeGJxYyW8rF3Kn/G4YbW8Pv1GJhBXlS4DPr2K9W52lAiAtWoOuoVtJIPd5L8Ex63GisQ5TLZnU6jGoiscoW8yxPg=="}]},"directories":{}},"0.2.1":{"name":"xorshift","description":"Random number generator using xorshift128+","version":"0.2.1","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"main":"./xorshift.js","scripts":{"test":"tap test.js","benchmark":"node ./benchmark.js"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"keywords":["random","rng","xorshift"],"devDependencies":{"tap":"0.4.x"},"license":"MIT","gitHead":"ed9e7dab23d9b23688601bee033cbaed47185c59","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"homepage":"https://github.com/AndreasMadsen/xorshift#readme","_id":"xorshift@0.2.1","_shasum":"fcd82267e9351c13f0fb9c73307f25331d29c63a","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.2-pre","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"dist":{"shasum":"fcd82267e9351c13f0fb9c73307f25331d29c63a","tarball":"https://registry.npmjs.org/xorshift/-/xorshift-0.2.1.tgz","integrity":"sha512-P7vgjXF9fGNdj97iI5v9nMnh1RpUROBlbfITf5CTAhaz96h/vKI/Lo5nikVqE0pBvraYNjdPIyOfHmECh7Mxxg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDcD2f4vNfmZiMP+4CibBd7DWStJzUBDEJgeR1nlMIdHQIgAdFR3XZoFOU1TuaJSbb68LDtrpjLszlLOF/Q/RJM2Ew="}]},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/xorshift-0.2.1.tgz_1474715744000_0.49601434567011893"},"directories":{}},"1.0.0":{"name":"xorshift","description":"Random number generator using xorshift128+","version":"1.0.0","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"main":"./xorshift.js","scripts":{"test":"tap test.js","benchmark":"node ./benchmark.js"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"keywords":["random","rng","xorshift"],"devDependencies":{"tap":"0.4.x"},"license":"MIT","gitHead":"821e6c2338bd41ae9ea60d3bbb307158ded1b721","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"homepage":"https://github.com/AndreasMadsen/xorshift#readme","_id":"xorshift@1.0.0","_shasum":"1d256c2276a235252e5c94f91688f3fb99f4eb61","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.2-pre","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"dist":{"shasum":"1d256c2276a235252e5c94f91688f3fb99f4eb61","tarball":"https://registry.npmjs.org/xorshift/-/xorshift-1.0.0.tgz","integrity":"sha512-YLtkvWX76tcGEpBFh3EPc+c3axhITyig8avOmR1JhdzAftmApFv3LKhPciXwX3UiB8BQ1X54vFcHqmHyRTIczg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+IvOhTaFzWEVO8PIoRgn3gc+en5nF3PpBQoZBrdbtxgIhAPsqf2B0AJZBcrrqdCwk8pR53IMEKaHXUV6BK9V/VVoW"}]},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/xorshift-1.0.0.tgz_1474716556908_0.466318323276937"},"directories":{}},"1.1.0":{"name":"xorshift","description":"Random number generator using xorshift128+","version":"1.1.0","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"main":"./xorshift.js","scripts":{"test":"tap test.js","benchmark":"node ./benchmark.js"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"keywords":["random","rng","xorshift"],"devDependencies":{"tap":"0.4.x"},"license":"MIT","gitHead":"e31b879d16dad33dd8a238729dadd27f801e0284","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"homepage":"https://github.com/AndreasMadsen/xorshift#readme","_id":"xorshift@1.1.0","_npmVersion":"5.0.3","_nodeVersion":"9.0.0-pre","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"dist":{"integrity":"sha512-KNE56UQ8VOpHdzkse7qc3XqAvueZd9bUYIpghtWIoNrKWwRHwpWK5r5lEb3u8SGT6vfjzy6zEK+MECPBjkikDA==","shasum":"862e98147cb58136f55c7baebbda9c8474a1430f","tarball":"https://registry.npmjs.org/xorshift/-/xorshift-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD3PDbTC0nmQwwfWG3minj0wU8Du3eiZnrX2QLJvdyEGAIhAOJ35FO/IyYnsYtN64/cVkRK91pJZEPUTC12d67ib/xm"}]},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xorshift-1.1.0.tgz_1499573474248_0.8265900542028248"},"directories":{}},"1.1.1":{"name":"xorshift","description":"Random number generator using xorshift128+","version":"1.1.1","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"main":"./xorshift.js","scripts":{"test":"tap test.js","benchmark":"node ./benchmark.js"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"keywords":["random","rng","xorshift"],"devDependencies":{"tap":"0.4.x"},"license":"MIT","gitHead":"94c1a5e8d64b7f632d620137e3cd17e1fd49664e","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"homepage":"https://github.com/AndreasMadsen/xorshift#readme","_id":"xorshift@1.1.1","_npmVersion":"5.3.0","_nodeVersion":"9.0.0-pre","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"dist":{"integrity":"sha512-GMYHpzXeRwVXaHckrEbqqSNjNbms1oRSntP2weG4mrUMWAoLgF4b0ag/qqpYRbDEBfbC3Njt3+R5nX3lbP0Lww==","shasum":"fb85883a82a0625c9f11372205df75b67dfe53e0","tarball":"https://registry.npmjs.org/xorshift/-/xorshift-1.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDe3x+38M1CkdWxjrqI6s/nyg5AfBWhz/iswxLAydID7wIgcG/OY0Bu+XwE2E3lPdGhJfPjS8hGJVSRs2IxufJW8xI="}]},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xorshift-1.1.1.tgz_1508240569238_0.27366448612883687"},"directories":{}},"1.2.0":{"name":"xorshift","description":"Random number generator using xorshift128+","version":"1.2.0","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"main":"./xorshift.js","scripts":{"test":"tap test.js","benchmark":"node ./benchmark.js"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"keywords":["random","rng","xorshift"],"devDependencies":{"tap":"0.4.x"},"license":"MIT","gitHead":"741f76a721d236963760f78e536a7a13d1403e88","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"homepage":"https://github.com/AndreasMadsen/xorshift#readme","_id":"xorshift@1.2.0","_nodeVersion":"16.2.0","_npmVersion":"7.13.0","dist":{"integrity":"sha512-iYgNnGyeeJ4t6U11NpA/QiKy+PXn5Aa3Azg5qkwIFz1tBLllQrjjsk9yzD7IAK0naNU4JxdeDgqW9ov4u/hc4g==","shasum":"30a4cdd8e9f8d09d959ed2a88c42a09c660e8148","tarball":"https://registry.npmjs.org/xorshift/-/xorshift-1.2.0.tgz","fileCount":9,"unpackedSize":26329,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFtShCRA9TVsSAnZWagAAt0oP/0Hmov3isT76GHlMlEGJ\nzuAcqYGTRCc5fZTJn9d6jRsiw1f/pEI15dFFM77+oN6QFYDd/XjPb2FYixiH\n8IX0/5lDX8o73EHxdEu/cTOhTM78hH5lN/ikS46BWuZpnjUNUXA7ZPpTbzi6\n11RgGB3RpPbz55lWpwlH90NCsMPomWp98bJ3SI4dZIvPjNAJGrIQjMFvHCwh\nGH/sXNorABueut5U84J88p/65udPnsmMTW6IsNEeAv0TKQ5hcXr1uXfaewgd\nS50PAXF8nfEhd3qwOnwT5sVEwnxZTr3mOsXQtlyrJmuOXAIx8J8/Is3dT8Dq\n1/w5vvjmD7h/bNYEQjipNKe15dscokRulEXOI9LDgXcBQy2TZUlAXnHkjzx4\nJhspCpQnPKp69F9amgy/KsnoDdXeTsZ/hqmGDHsmVSrRBLri71kSR4nHLhOA\na+GEeLH0eLYMxfJmXdMcaXjJ0MWJIPm454ZihOGzTbeisRktJBFcTXrH5BZ7\n5gmCqem12tGz1P0G89LnHefWqFUC0XSjY13zoNB9nxfGCpZEMyoAX+IoFR/k\n7BA3RbcDUJ6uFliXzK25SQdnMgALK8DxvyKTPt45ce2fZfhPo/R7gsv985/W\nDTZh/HgiBlQuK9Exkomk0P0njnItMNMkoYu/0gpD6ECEOC8T3c3vRdeqJf4E\na2Rs\r\n=KkEh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtwn8fqcNFjw6Tqdww8dzNEJeV0AhzbwMdFyUB0uYtKwIhAKuYp+6nbtGVcp1pIDQBtv52IBIbDnBSMpazoE/jl1tu"}]},"_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"directories":{},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xorshift_1.2.0_1628886177595_0.45463588003037114"},"_hasShrinkwrap":false}},"readme":"# xorshift [![Build Status](https://travis-ci.org/AndreasMadsen/xorshift.svg?branch=master)](https://travis-ci.org/AndreasMadsen/xorshift)\n\n> Pseudorandom number generator using [xorshift128+](http://xorshift.di.unimi.it/)\n\n## Installation\n\n```bash\nnpm install xorshift\n```\n\n## Example\n\n```javascript\nvar xorshift = require('xorshift');\n\nfor (var i = 0; i < 10; i++) {\n  console.log(xorshift.random()); // number in range [0, 1)\n}\n```\n\n## Documentation\n\nThis module exports a default pseudo random generator. This generators seed have\nalready been set (using `Date.now()`). If this is not suitable a custom\ngenerator can be initialized using the constructor function\n`xorshift.constructor`. In both cases random numbers can be generated using\nthe two methods `.random` and `.randomint`.\n\n```javascript\nvar xorshift = require('xorshift');\n```\n\n### xorshift.random()\n\nThis method returns a random 64-bit double, with its value in the range [0, 1).\nThat means 0 is inclusive and 1 is exclusive. This is equivalent to\n`Math.random()`.\n\n```javascript\nconsole.log(xorshift.random()); // number between 0 and 1\n```\n\nThis method will serve most purposes, for instance to randomly select between\n2, 3 and 4, this function can be used:\n\n```javascript\nfunction uniformint(a, b) {\n  return Math.floor(a + xorshift().random() * (b - a));\n}\n\nconsole.log(uniformint(2, 4));\n```\n\n### xorshift.randomint()\n\nThis method returns a random 64-bit integer. Since JavaScript doesn't support\n64-bit integers, the number is represented as an array with two elements in\nbig-endian order.\n\nThis method is useful if high precision is required, the `xorshift.random()`\nmethod won't allow you to get this precision since a 64-bit IEEE754 double\nonly contains the 52 most significant bits.\n\n```javascript\nvar bview = require('binary-view');\nconsole.log(bview( new Uint32Array(xorshift.randomint()) ));\n```\n\n### xorshift.constructor\n\nThis method is used to construct a new random generator, with a specific seed.\nThis is useful when testing software where random numbers are involved and\ngetting consistent results is important.\n\n```javascript\nvar XorShift = require('xorshift').constructor;\nvar rng1 = new XorShift([1, 0, 2, 0]);\nvar rng2 = new XorShift([1, 0, 2, 0]);\n\nassert(rng1.random() === rng2.random());\n```\n\nA `XorShift` instance have both methods `random` and `randomint`. In fact the\n`xorshift` module is an instance of the `XorShift` constructor.\n\nThe constructor can also be accessed as `require('xorshift').XorShift`, which\nis useful when using the `import` syntax.\n\n```javascript\nimport { XorShift } from 'xorshift'\n```\n\n## Reference\n\nThis module implements the xorshift128+ pseudo random number generator.\n\n> This is the fastest generator passing BigCrush without systematic\n> errors, but due to the relatively short period it is acceptable only\n> for applications with a very mild amount of parallelism; otherwise, use\n> a xorshift1024* generator.\n> – <cite> http://xorshift.di.unimi.it </cite>\n\nThis source also has a\n[reference implementation](http://xorshift.di.unimi.it/xorshift128plus.c)\nfor the xorshift128+ generator. A wrapper around this implementation has been\ncreated and is used for testing this module. To compile and run it:\n\n```shell\ngcc -O2 reference.c -o reference\n./reference <numbers> <seed0> <seed1>\n```\n\n* `<numbers>` can be any number greater than zero, and it will be the number\nof random numbers written to `stdout`. The default value is `10`.\n* `<seed0>` and `<seed1>` forms the 128bit seed that the algorithm uses. Default\nis `[1, 2]`.\n\n## License\n\n**This software is licensed under \"MIT\"**\n\n> Copyright (c) 2014 Andreas Madsen & Emil Bay\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"time":{"modified":"2022-06-29T05:50:50.681Z","created":"2014-11-15T19:02:08.317Z","0.1.0":"2014-11-15T19:02:08.317Z","0.2.0":"2014-11-23T12:04:42.942Z","0.2.1":"2016-09-24T11:15:45.239Z","1.0.0":"2016-09-24T11:29:18.139Z","1.1.0":"2017-07-09T04:11:15.289Z","1.1.1":"2017-10-17T11:42:50.233Z","1.2.0":"2021-08-13T20:22:57.738Z"},"homepage":"https://github.com/AndreasMadsen/xorshift#readme","keywords":["random","rng","xorshift"],"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"license":"MIT","readmeFilename":"README.md","contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"users":{"dzhou777":true,"moimikey":true,"shanewholloway":true}}