{"_id":"@bluelovers/xorshift","_rev":"2-78d33c87feedaef916dc864790ebfab7","name":"@bluelovers/xorshift","dist-tags":{"latest":"1.2.1"},"versions":{"1.2.0":{"name":"@bluelovers/xorshift","version":"1.2.0","description":"Random number generator using xorshift128+","keywords":["random","rng","xorshift","create-by-yarn-tool","create-by-tsdx"],"homepage":"https://github.com/AndreasMadsen/xorshift#readme","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"license":"MIT","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.esm.mjs","require":"./dist/index.cjs"}},"main":"dist/index.cjs","module":"dist/index.esm.mjs","types":"dist/index.d.ts","typings":"dist/index.d.ts","directories":{"test":"test"},"scripts":{"pretest":"yarn run build","test":"yarn run test:tap && yarn run test:tap:esm","test:tap":"tap --no-coverage test.js","test:tap:esm":"node --enable-source-maps --experimental-json-modules test.mjs","posttest":"echo posttest","build":"yarn run build:tsdx && yarn run build:dts","build:dts":"ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner & echo build:dts","build:tsdx":"ynpx @bluelovers/tsdx build --target node --name index","npm:publish":"npm publish","npm:publish:bump":"yarn run version:bump && npm publish","preversion":"echo preversion && yarn run test","version":"echo version","version:bump":"yarn-tool version","postversion":"echo postversion","prepublish":"echo prepublish","prepublishOnly":"yarn run preversion","prepublishOnly:check-bin":"ynpx --quiet @yarn-tool/check-pkg-bin","prepublishOnly:update":"yarn run ncu && yarn run sort-package-json","publish":"echo publish","postpublish":"yarn run postpublish:changelog && yarn run postpublish:git:commit && yarn run postpublish:git:tag && yarn run postpublish:git:push","postpublish:changelog":"ynpx --quiet @yarn-tool/changelog && git add ./CHANGELOG.md","postpublish:git:commit":"git commit -m \"chore(release): publish\" . & echo postpublish:git:commit","postpublish:git:push":"git push --follow-tags","postpublish:git:tag":"ynpx --quiet @yarn-tool/tag","postpublishOnly":"echo postpublishOnly","benchmark":"node ./benchmark.js","ncu":"yarn-tool ncu -u","sort-package-json":"yarn-tool sort","tsc:showConfig":"ynpx get-current-tsconfig -p"},"devDependencies":{"@bluelovers/tsconfig":"^1.0.28","@types/node":"^17.0.0","@types/tap":"^15.0.5","binary-view":"^0.2.0","tap":"15.1.x"},"publishConfig":{"access":"public"},"packageManager":"yarn@^1.22.11","gitHead":"c0692a109bec08f36594c617bf3e7339ce8f1f8c","_id":"@bluelovers/xorshift@1.2.0","_nodeVersion":"17.2.0","_npmVersion":"8.1.4","dist":{"integrity":"sha512-uJJ0WKp0tjHr7DZg+11+6ZH2k0i6wio5JYp164zkUStBEHJSAjS1LqtSPg2Ywbob7eMA+fg5evI17I+Ps8y3AQ==","shasum":"665451ab008681d692c04c32d125612573d2108a","tarball":"https://registry.npmjs.org/@bluelovers/xorshift/-/xorshift-1.2.0.tgz","fileCount":16,"unpackedSize":62412,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhvNS9CRA9TVsSAnZWagAA7cAP/Rj/8JRLbHEMxt1fTrSe\nHoI3xXRpaJ9pq5bPj5oWKHQ2U9P+PY7YolMrFkkBs4qlX8dOaGdLBBOHx1g6\nMcu9X0VJ1jjl7Mp2EgtyQffGTqcR4obOOiQi4cp6J3b+oXWAoAHYJGYHrNSm\n9g9YRlOC+LfJaNxaUOHEAC5+K94DAzDcWrvbosGoXFMkvCY49x9vLLfv53/P\nWqN5mBPTOOwTyIKVIdy2bZetUTXI11cEI+VYJHwy8+UNvhMS4iJfVP1VtlAf\nEZVnNgxFjI5bgNBVwvgjQXmixuql1Vv7UAp5DCpqWsHzZ5IXaCYjm7KfSzix\natUumZc5IowlweN3virFbD5FN+m4XrW8Z/trOPhujezNcuTjJXkdVNPLjdnE\nuPVJQxdNlih5aWWxDB4OHS2Qt4LfGr8zt/wx7pmftnmoDkhUNLXbUrM2jjRN\nC7nsJxZxioH/WfPB2hz3Aw0yTMk9MGggHT9Vdh2pOwqpSKwyxFGZKaPCYkvn\nkbl8Trq+hTxCyZsu5AdP10bAZ5BX+HI7PJJgKBVZkKzkVKt40yjlnnxBxJkL\nedE6KPkpyeZUlP9RK0gHHWYNX2kMDPo62xAq94zSO94g6lAaXjs5qLxpUwuV\nyAm19ukaKGGpFULSJ5Q6EGHgSt9rKZplWSRg7ASESe17N4wddPp2HTg7Lk26\n2lRM\r\n=X/f4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDuMfV3y/+eORV7zEB/HCbgX1Z/VUWNdPgoe6P4WjScEAiEA/9l1ijfnEEQ3Exl1dJLGIqMzQ6dm3S8eFpzTRBpdQVI="}]},"_npmUser":{"name":"bluelovers","email":"codelovers@users.sourceforge.net"},"maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xorshift_1.2.0_1639765181783_0.8486769550313422"},"_hasShrinkwrap":false},"1.2.1":{"name":"@bluelovers/xorshift","version":"1.2.1","description":"Random number generator using xorshift128+","keywords":["random","rng","xorshift","create-by-yarn-tool","create-by-tsdx"],"homepage":"https://github.com/AndreasMadsen/xorshift#readme","bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"license":"MIT","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.esm.mjs","require":"./dist/index.cjs"}},"main":"dist/index.cjs","module":"dist/index.esm.mjs","types":"dist/index.d.ts","typings":"dist/index.d.ts","directories":{"test":"test"},"scripts":{"pretest":"yarn run build","test":"yarn run test:tap && yarn run test:tap:esm","test:tap":"tap --no-coverage test.js","test:tap:esm":"node --enable-source-maps --experimental-json-modules test.mjs","posttest":"echo posttest","build":"yarn run build:tsdx && yarn run build:dts","build:dts":"ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner & echo build:dts","build:tsdx":"ynpx @bluelovers/tsdx build --target node --name index","npm:publish":"npm publish","npm:publish:bump":"yarn run version:bump && npm publish","preversion":"echo preversion && yarn run test","version":"echo version","version:bump":"yarn-tool version","postversion":"echo postversion","prepublish":"echo prepublish","prepublishOnly":"yarn run preversion","prepublishOnly:check-bin":"ynpx --quiet @yarn-tool/check-pkg-bin","prepublishOnly:update":"yarn run ncu && yarn run sort-package-json","publish":"echo publish","postpublish":"yarn run postpublish:changelog && yarn run postpublish:git:commit && yarn run postpublish:git:tag && yarn run postpublish:git:push","postpublish:changelog":"ynpx --quiet @yarn-tool/changelog && git add ./CHANGELOG.md","postpublish:git:commit":"git commit -m \"chore(release): publish\" . & echo postpublish:git:commit","postpublish:git:push":"git push --follow-tags","postpublish:git:tag":"ynpx --quiet @yarn-tool/tag","postpublishOnly":"echo postpublishOnly","benchmark":"node ./benchmark.js","ncu":"yarn-tool ncu -u","sort-package-json":"yarn-tool sort","tsc:showConfig":"ynpx get-current-tsconfig -p"},"devDependencies":{"@bluelovers/tsconfig":"^1.0.28","@types/node":"^17.0.0","@types/tap":"^15.0.5","binary-view":"^0.2.0","tap":"15.1.x"},"publishConfig":{"access":"public"},"packageManager":"yarn@^1.22.11","gitHead":"66f51bb6c1e8823b0791c2dafcb55068cba06a59","_id":"@bluelovers/xorshift@1.2.1","_nodeVersion":"17.2.0","_npmVersion":"8.1.4","dist":{"integrity":"sha512-IrLLS5NQB5v5lpN9ZAxTgVf8POhpA+SKHxdqQy7eMB5eGiNdaxuhhA56zpOSxGfhQH9paYIoaEtDUpVq5P1zwQ==","shasum":"1431bb6bfb9a8fdba89cac355ef0605f423c6d6f","tarball":"https://registry.npmjs.org/@bluelovers/xorshift/-/xorshift-1.2.1.tgz","fileCount":17,"unpackedSize":72822,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhvRRBCRA9TVsSAnZWagAAqr8P/16P1dvMp5Gshq8/sQb0\n070+/ghxpLPpLzKJBV0R2KNT/BQVaEfxwDWC+R7jSHZx6gVl/Suak0akp/Cs\nPaff4QqA3zUmn9MD9cPxE1UZ6zQZG/mvdeJboE3JlEF9KOGz3uH8B/7G/s71\n5nA4dofiaL0UZepaVGCOIEecKFV8T/AVC7TmRXoLjiGLzS3hdXonvhW8Inck\n967nMncJu/cnb4iH7HwHRKzFOStGTzLfarHDM5+NTjXpg6T4lAmqksSzJOY4\nJNrq63Urb1DH4QvdxvAWiF+3rYgU1tXu1SvE8KiPnsMNULxtmVsg91UYj+sO\npZQZRof97xZp3+3EFkcXLXLev78GTlNeTn6xhobWPq7/M4YNXFWNq1vatlv2\n1JmwJ69QGD9ojwVeKvXonNUo6pPNIfNDtjUUCEuX7gB8KSWsZOTZDeDQ5wJy\nCC3iXZTZyuT3FHp3i6JFbwBu3MGR+PsXuaIvDM6B2Tb0b1MEcVlWBmek+d2y\nJJdfy872Seu1xGeNSdLwvCf0WFKrrXYAl5l7yTxwGSzJED7aueXr8zp6xVP5\nIhtWgO5hj9a7UtfmL+Re8mdcUDR2MHxtR5o7l2u9tp/r160EJECgS96x8rKs\nHlu5A7PX1gH0XaNUbFglb5n+jl+wYdc0IsQ/1NxQq98bvnJeeMfT7gSoDl1D\nhTJ8\r\n=2F75\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4KzF3UcPNJ8vexlCZEe7w1npqH9gZ+o6ILE0jMVw+dAIgQhS/w52mY25BW1K3VgJdehC5oWNvSRLwX72Y/6m/T8I="}]},"_npmUser":{"name":"bluelovers","email":"codelovers@users.sourceforge.net"},"maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xorshift_1.2.1_1639781441083_0.8792262281957606"},"_hasShrinkwrap":false}},"time":{"created":"2021-12-17T18:19:41.724Z","1.2.0":"2021-12-17T18:19:41.976Z","modified":"2022-04-04T19:49:09.146Z","1.2.1":"2021-12-17T22:50:41.313Z"},"maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"description":"Random number generator using xorshift128+","homepage":"https://github.com/AndreasMadsen/xorshift#readme","keywords":["random","rng","xorshift","create-by-yarn-tool","create-by-tsdx"],"repository":{"type":"git","url":"git://github.com/AndreasMadsen/xorshift.git"},"contributors":[{"name":"Emil Bay","email":"github@tixz.dk"}],"author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"bugs":{"url":"https://github.com/AndreasMadsen/xorshift/issues"},"license":"MIT","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').default;\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').default;\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').default.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","readmeFilename":"README.md"}