{"_id":"@alisey/pcg32","_rev":"3-7015c6cfe78b9b45b598f7fccbfef993","name":"@alisey/pcg32","dist-tags":{"latest":"1.1.0"},"versions":{"0.1.0":{"name":"@alisey/pcg32","version":"0.1.0","author":{"name":"Alexey Lebedev"},"description":"PCG-32 random number generator implemented in WebAssembly","homepage":"https://github.com/alisey/pcg32","license":"MIT","type":"module","main":"dist/index.js","engines":{"node":">=16"},"scripts":{"build":"node build.js","demo":"node extras/demo.js","pretest":"npm run build","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js","perf":"node extras/perf.js"},"devDependencies":{"fs-extra":"^10.0.0","jest":"^27.4.3","wabt":"^1.0.24"},"gitHead":"bb7279eca2554f13413036fa613c051690b68220","_id":"@alisey/pcg32@0.1.0","_nodeVersion":"17.0.1","_npmVersion":"8.1.0","dist":{"integrity":"sha512-cLFlRG9RPJEJzuUHQQSbfQwa/U99CLjLBCTvaJE4LHIyzpIPjuTQ8O0lOte/wEj6P+vCHT+gft0vj51WZUr0Pg==","shasum":"66bc62e3184efd5246555ad185f6b23f3802756f","tarball":"https://registry.npmjs.org/@alisey/pcg32/-/pcg32-0.1.0.tgz","fileCount":4,"unpackedSize":5916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqgL9CRA9TVsSAnZWagAAc+AP/AmjYGF0HkEMIQEL+8Xu\n7fABleLr+Vj0aR7nwZVnyTgRxryA1aMQgK6yZ1z5ffWL4S7xOij1sxzXfLj6\nqVHhzIt5iPlBfkS0H7QAMhpQOP/a05eQScxYyBEa5quEAYLeNsIONe2Qb0+Z\nt3xpZbR2OvtoGJilCLuTRL/AeJcbpFXl97atT2szLoZ+Q9ti78sUSlkR+AuB\nOiki+0NEx2HazD7+vGagIr+xRqMfcMAG/iMunw9oYGBnSf6qaOzihyz0EFDL\nxmGZvoLGY7ryNmgGyyeJgMFRdhldrmEsmpjRyF7WaqBITXOoJJ2BKUBl5xun\n2z7iS1eVnSB9oSn4Y9qqQ0VaG6+f5EwoXD7fw6GdvcQCoh5DX7T0RFq/9/Hp\nSVWIOsRnsHz1uXlaFskn/nLA1kW1AHbQttuIXYOR3RJBKmV87fIf1P4kY7TR\nLQM/n0irZl/ny0ciSDRaWQQOBnG4HV+il7MpYnK5xMsO2XKkZu+hILOpb1fL\n3q6etdFJ4nuCtV4qxSUDycjMlNnjSoyhd8W5DQr+4aotaq50mkkG57NKFC8T\nh8fSq4sn0jbhvZRKndOc1frWCjS0vQuSVNswjUPeUzl0FQxHkDEFMR94yTll\neoiKO0ByOFOUM1dreezIlxSrAi6DmXC3kABt7OCHHQFUW+hELI88tMQG7I+1\nD4Yq\r\n=HOtH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1Hupg/v4rK9C2DO4se7rWOMF+g4LhsaPYzI/XHyAqfQIgWF/ipPNDy1PguGx33Cc+W7/GFQ6gRKKFFl9EOHfEsTU="}]},"_npmUser":{"name":"alisey","email":"alisey.login@gmail.com"},"directories":{},"maintainers":[{"name":"alisey","email":"alisey.login@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pcg32_0.1.0_1638531837399_0.80638762869554"},"_hasShrinkwrap":false},"1.0.0":{"name":"@alisey/pcg32","version":"1.0.0","author":{"name":"Alexey Lebedev"},"description":"PCG-32 random number generator implemented in WebAssembly","homepage":"https://github.com/alisey/pcg32","license":"MIT","keywords":["rng","prng","random","pcg"],"type":"module","main":"dist/index.js","engines":{"node":">=16"},"scripts":{"build":"node build.js","demo":"node extras/demo.js","pretest":"npm run build","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js","perf":"node extras/perf.js"},"devDependencies":{"fs-extra":"^10.0.0","jest":"^27.4.3","wabt":"^1.0.24"},"gitHead":"d56aef9ede3a4765b937da68f4788b9c6a281c79","_id":"@alisey/pcg32@1.0.0","_nodeVersion":"17.0.1","_npmVersion":"8.1.0","dist":{"integrity":"sha512-zFD16LbqYEdYCBBlA/WwIQ50FG6h2eadykYMeV3AtRVxdSVpKJWrgGY4NiLdmL9OQeJ+QbxXAnZ1x0seB/eU6A==","shasum":"a93db5c62a67af27852374c896aa720b61137316","tarball":"https://registry.npmjs.org/@alisey/pcg32/-/pcg32-1.0.0.tgz","fileCount":4,"unpackedSize":6076,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqgYdCRA9TVsSAnZWagAAC1MP/ib5u/PbyPS8RojmlH/G\n55wORM1eXXxJ++SqI0PLfEdmTZ67RjxwCg4ar0Az6FnQCpGSUpTjXfa6gZMK\n7oB9RgZdtVU8jCkk3tf4OYP/5gNY1uHpuSskzW1J9j8e88sieSWuUC1FOvX5\njUBaPMEnNE6lPDXPcr2rnnYokzeqGUBsxOam6ReSXd3EGz+Sx4Fw6TeCw7q3\nGiFpsFvS1lDhGg85b/LDBVVRJqig+hHBd5JQ/2l/eOlDALWse611Mn4anKIY\n/hU7BzVJAtnCllfnFTsVY5Qz2uweDdpF2QMiWNNZtTlmIrEB66vIxAWCvmIk\n2EGv7UM25WWV8aEKOV64aNffAYezTN1vk/7737FleWFVHcCYZnRm5JYDFxCZ\ntsMMqUcmFRbGQI5+hN2bveUqdlKvveRv04+tZG0t0imZRU6iBhxu3SdgwiE7\nNxdk+1zlzi/7WFUc8gx/ngWC+AiyEcswbGdJewqoZcUFTAsbDM8NdaQWFsH4\n9mWEHQCORMx/nFqzP4Bl+FKz5cb9+vkgpoWrt7X+QCittbGaF6edXy1vPW4m\nMXIB2+G1myDufR9oA5RbjHirSw0khEyRl9fdL1/qsugVJ5i1qpiM4ygHrKs+\naWqvDIadrMvwisN7mL7q/Jw28Z/n1wO3HXB8jT5SVl0PGXDUN42XJwdhm9cG\nxcVn\r\n=LjRQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBJuJU3H0C/ksBINlByjLVhooWg5oJl47s+p+a3gsxUUAiEAh5PdzFzqxBIPJw8OruuySUivJknxFv5vLWqvNLJ72n0="}]},"_npmUser":{"name":"alisey","email":"alisey.login@gmail.com"},"directories":{},"maintainers":[{"name":"alisey","email":"alisey.login@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pcg32_1.0.0_1638532637140_0.2185563552633858"},"_hasShrinkwrap":false},"1.1.0":{"name":"@alisey/pcg32","version":"1.1.0","author":{"name":"Alexey Lebedev"},"description":"PCG-32 random number generator implemented in WebAssembly","homepage":"https://github.com/alisey/pcg32","license":"MIT","keywords":["rng","prng","random","pcg"],"type":"module","main":"dist/index.js","engines":{"node":">=16"},"scripts":{"build":"node build.js","demo":"node extras/demo.js","pretest":"npm run build","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js","perf":"node extras/perf.js"},"devDependencies":{"fs-extra":"^10.0.0","jest":"^27.4.3","wabt":"^1.0.24"},"gitHead":"e7848d27e1ebf60db5200d05585162a741944bf4","_id":"@alisey/pcg32@1.1.0","_nodeVersion":"17.0.1","_npmVersion":"8.1.0","dist":{"integrity":"sha512-Wwg4fzPHpIorjvQDeiRdoboA1WzLYIEmkHl4QoISS08Pg+IwMeQb8wwxBPuX3x1sAVmTAoboIQiwaV890h7qsA==","shasum":"7fb74b4585fe919fa38badf8ad9f799c4d451f3c","tarball":"https://registry.npmjs.org/@alisey/pcg32/-/pcg32-1.1.0.tgz","fileCount":4,"unpackedSize":7891,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhsQX7CRA9TVsSAnZWagAAl88QAIU+O8PoNwwRCbeTldTa\ny8wPtohm2auDOVay41QGvw7BCX+Fisvzd4J6zie5cG8qUmL1JC76SE+qB/lC\nHnUmr/hhJiEGOQBGWUr+KmCKoJm1wbZ2fjfDX8PMEe25dJS8l60XBeHm7qRG\nvQgFPiHIySt/3lRH/QkXDpt18XEWHkgibP1X8xc4XvDSxRPVz8BG3cE/OpJh\nev2p3Ii08nnwVVM1kxZ9lzo9ms0uLlTQCAILd19un6vviU8P1fO/VCUFMdZ9\n/8YgUluhc70ao5oCBEzvWzwTETVFBCKy1TK+5llt9moBDgdJBb1kua/+jSxd\nYi8r1Nzf3abzvfDxQpdP8U8Wedtk0aCaDr7divwT2bjfbJ8af5A8aM/S/Mj4\nmLnBKF9FPermiBlXRZcJS2POf/VVlw4TRZEENomxeLqBIs7a8w3H2x0RIxHP\n2m/Cbxdoq8qAs9glqJyKV4LH5PmVA/UbCzPtJGuSi1JX57+PQ+SUbUiAHIi4\n+n0/6WOW/zVU/Bqy9MObd/l6Nm2gqq1/bYM2lCoYNQ7dKyehtMSUQTgK51XS\nHwCiOJvCL1+3RoPsghDFeu/JNy7kPsYrGtALSplbhdafeRWfA0R1qe2P1m2k\nQNEYsDgnG6O2LesCy5ZlRN2zSBbfWtsVW0f0g+XLfJxErhfyOYziL1sI1FfE\n2oDB\r\n=E7Oz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICQRnPRKiFIFmgvy5AuwaOHdmHE1HLGey2+pa0srxgApAiEAutmxx4auEIzKMtXCIgPaxGjgdS3cJFOOZFm1/lkWd40="}]},"_npmUser":{"name":"alisey","email":"alisey.login@gmail.com"},"directories":{},"maintainers":[{"name":"alisey","email":"alisey.login@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pcg32_1.1.0_1638991355179_0.17464548048709494"},"_hasShrinkwrap":false}},"time":{"created":"2021-12-03T11:43:57.344Z","0.1.0":"2021-12-03T11:43:57.547Z","modified":"2022-04-04T13:27:45.430Z","1.0.0":"2021-12-03T11:57:17.290Z","1.1.0":"2021-12-08T19:22:35.371Z"},"maintainers":[{"name":"alisey","email":"alisey.login@gmail.com"}],"description":"PCG-32 random number generator implemented in WebAssembly","homepage":"https://github.com/alisey/pcg32","author":{"name":"Alexey Lebedev"},"license":"MIT","readme":"# PCG-32: A Seedable 32-bit PRNG\n\nA WebAssembly port of the PCG Random Number Generator, [Minimal C Edition](https://github.com/imneme/pcg-c-basic).\n\n## Usage\n\n```js\nimport * as pcg from '@alisey/pcg32';\n\npcg.setState(0x0123456789ABCDEFn);\n\nconsole.log(pcg.randomInt(10)); // ⇒ 5\nconsole.log(pcg.random());      // ⇒ 0.3697000732146962\n```\n\n## API\n\n##### `randomInt(bound: number): number`\n\nReturns a uniformly distributed 32-bit unsigned random integer in the range\n[0, bound), where `bound` is a number from 1 to 2³².\n\n##### `random(): number`\n\nReturns a uniformly distributed  floating point number in the range [0, 1) that\nhas been rounded down to the nearest multiple of 2⁻⁵³.\n\n##### `setState(state: bigint): void`\n\nUpdates the internal state of the generator. The generator has 2⁶⁴ possible\ninternal states, and iterates through all of them. `state` is a 64-bit unsigned\nBigInt.\n\n##### `getState(): bigint`\n\nReturns a 64-bit unsigned BigInt representing the internal state of the\ngenerator.\n\n##### `seed(value?: bigint): void`\n\nSeeds the generator with a 64-bit BigInt. If the value is not provided, uses\na value based on `Math.random()`.\n\n## Performance\n\nAs of 2021, in V8 `pcg.randomInt()` is as fast as\n`Math.floor(Math.random() * n)`, but doesn't introduce bias. `pcg.random()` is\n2 times slower than `Math.random()`.\n\nIn SpiderMonkey and JavaScriptCore both functions are 10 times slower than\nnative equivalents.\n\n## Working With This Repo\n\n1. `npm install`\n2. `npm run build`\n3. `npm run test`\n4. `npm run demo`\n5. `npm run perf`\n\n## Links\n* [PCG: A Family of Better Random Number Generators](https://www.pcg-random.org)\n* [PCG: Using the Minimal C Implementation](https://www.pcg-random.org/using-pcg-c-basic.html)\n","readmeFilename":"README.md","keywords":["rng","prng","random","pcg"]}