{"_id":"@bygdle/random-pool","_rev":"6-7652ee84ff11248c5c9c4669936dcb8f","name":"@bygdle/random-pool","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"@bygdle/random-pool","version":"1.0.0","description":"Select random items from a pool of items","main":"dist/index.js","scripts":{"prepare":"npm run build","test":"jest","build":"webpack --mode=production --node-env=production","dev":"webpack --watch"},"repository":{"type":"git","url":"github.com/NiuWeb/random-pool"},"keywords":["random","pool"],"author":{"name":"bygdle"},"license":"MIT","devDependencies":{"@babel/core":"^7.22.9","@babel/preset-env":"^7.22.9","@babel/preset-typescript":"^7.22.5","@types/jest":"^29.5.3","@webpack-cli/generators":"^3.0.7","babel-jest":"^29.6.1","jest":"^29.6.1","prettier":"^2.8.8","ts-loader":"^9.4.4","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"types":"./dist/index.d.ts","gitHead":"e76e230224105b32a94361ece8fe819012c27315","_id":"@bygdle/random-pool@1.0.0","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-ncNb7Rv6iNiGErAztHqY+bp1V7lqq6D/yG44lUGc4SVzrs1AT5RV0RQh0tfB3nYtCWGMR5/sxGpkE/nvMkTNJQ==","shasum":"6729a2370713d920b8fe920d710727103d4080a0","tarball":"https://registry.npmjs.org/@bygdle/random-pool/-/random-pool-1.0.0.tgz","fileCount":16,"unpackedSize":13965,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxgBey/kwAWs9kPVEfmQFKBO+g5G3wFIcOi71VsycwrQIgX5K9Uol1FmQv5RWUJ13zJCP7UOLoy2cxqCvgQQiXnUk="}]},"_npmUser":{"name":"bygdle","email":"danielfgarciagomez@outlook.es"},"directories":{},"maintainers":[{"name":"bygdle","email":"danielfgarciagomez@outlook.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-pool_1.0.0_1689620355257_0.033413616036966465"},"_hasShrinkwrap":false},"1.1.0":{"name":"@bygdle/random-pool","version":"1.1.0","description":"Select random items from a pool of items","main":"dist/index.js","scripts":{"prepare":"npm run build","test":"jest","build":"webpack --mode=production --node-env=production","dev":"webpack --watch"},"repository":{"type":"git","url":"github.com/NiuWeb/random-pool"},"keywords":["random","pool"],"author":{"name":"bygdle"},"license":"MIT","devDependencies":{"@babel/core":"^7.22.9","@babel/preset-env":"^7.22.9","@babel/preset-typescript":"^7.22.5","@types/jest":"^29.5.3","@webpack-cli/generators":"^3.0.7","babel-jest":"^29.6.1","jest":"^29.6.1","prettier":"^2.8.8","ts-loader":"^9.4.4","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"types":"./dist/index.d.ts","gitHead":"df5ab6108ec727c21947b68edde119904ce48057","_id":"@bygdle/random-pool@1.1.0","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-jRKurcLpVg+qBV7sGhWUDnAvQASAJfrNhJyF6mckkSKR2podYXvpOpMbDtWrQh4SElRly0gmpOWeVJNCER9+Kg==","shasum":"8ed1d58b7c13f6e34e0d746099432a2abb856482","tarball":"https://registry.npmjs.org/@bygdle/random-pool/-/random-pool-1.1.0.tgz","fileCount":16,"unpackedSize":14446,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEC2uyz7YEvXngYGehRuXx5txocCCxIThjYgLzipBlowIhALIrcwjR6DNRGGnyO+c6W4384TS/s8L3gGM8uVgURZWj"}]},"_npmUser":{"name":"bygdle","email":"danielfgarciagomez@outlook.es"},"directories":{},"maintainers":[{"name":"bygdle","email":"danielfgarciagomez@outlook.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-pool_1.1.0_1689629086675_0.2857344537397184"},"_hasShrinkwrap":false},"1.2.0":{"name":"@bygdle/random-pool","version":"1.2.0","description":"Select random items from a pool of items","main":"dist/index.js","scripts":{"prepare":"npm run build","test":"jest","build":"webpack --mode=production --node-env=production","dev":"webpack --watch"},"repository":{"type":"git","url":"github.com/NiuWeb/random-pool"},"keywords":["random","pool"],"author":{"name":"bygdle"},"license":"MIT","devDependencies":{"@babel/core":"^7.22.9","@babel/preset-env":"^7.22.9","@babel/preset-typescript":"^7.22.5","@types/jest":"^29.5.3","@webpack-cli/generators":"^3.0.7","babel-jest":"^29.6.1","jest":"^29.6.1","prettier":"^2.8.8","ts-loader":"^9.4.4","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"types":"./dist/index.d.ts","gitHead":"bb26a147283c4ed500dc75054da084d3a31f4e90","_id":"@bygdle/random-pool@1.2.0","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-Fwq7s5KgMe9d3jiIxBt2rs1e1hnRph+TMoF/It017vnw8VhN8Xg//Mi16laXYNJR46ndav+VMcAiW42N0wAuVQ==","shasum":"23dde7742e82fb4476dbcfaa03bd8a197b49268a","tarball":"https://registry.npmjs.org/@bygdle/random-pool/-/random-pool-1.2.0.tgz","fileCount":16,"unpackedSize":14214,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFPp+UXeEcwhdVblADf7T61Ylbo4hbFHchs1skaDaP9nAiEAiACLPvnDD+3sD7GosWOPEn/1hiZ8EyUknOuW5I0LwC8="}]},"_npmUser":{"name":"bygdle","email":"danielfgarciagomez@outlook.es"},"directories":{},"maintainers":[{"name":"bygdle","email":"danielfgarciagomez@outlook.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-pool_1.2.0_1689630626398_0.9448884059510769"},"_hasShrinkwrap":false},"1.2.1":{"name":"@bygdle/random-pool","version":"1.2.1","description":"Select random items from a pool of items","main":"dist/main.js","scripts":{"prepare":"npm run build","test":"jest","build":"webpack --mode=production --node-env=production","dev":"webpack --watch"},"repository":{"type":"git","url":"github.com/NiuWeb/random-pool"},"keywords":["random","pool"],"author":{"name":"bygdle"},"license":"MIT","devDependencies":{"@babel/core":"^7.22.9","@babel/preset-env":"^7.22.9","@babel/preset-typescript":"^7.22.5","@types/jest":"^29.5.3","@webpack-cli/generators":"^3.0.7","babel-jest":"^29.6.1","jest":"^29.6.1","prettier":"^2.8.8","ts-loader":"^9.4.4","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"gitHead":"69a4ead6fae306e5c9c27ab195787180900f7468","_id":"@bygdle/random-pool@1.2.1","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-OrwPfZlgBvgPb6QeA52OcktC8OaNH1jMUFX7U8wY1jRNeXCr2e7cJ+Er4A5HKqzF7XTnvWyk3oPyUrbIB4KPYQ==","shasum":"5cb4a9d0e1658a2bd951e6c02c756eb1534df952","tarball":"https://registry.npmjs.org/@bygdle/random-pool/-/random-pool-1.2.1.tgz","fileCount":16,"unpackedSize":14213,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBnNSe5XdxZJTcLQGk+qMdjwNWKHAX00cjtQ5eWYX62VAiBNV42pEiUatkV/1/gRl1M/c/UXvT78UqtCPY+AekEIVQ=="}]},"_npmUser":{"name":"bygdle","email":"danielfgarciagomez@outlook.es"},"directories":{},"maintainers":[{"name":"bygdle","email":"danielfgarciagomez@outlook.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-pool_1.2.1_1689944805442_0.8635898554181258"},"_hasShrinkwrap":false},"1.2.2":{"name":"@bygdle/random-pool","version":"1.2.2","description":"Select random items from a pool of items","main":"dist/main.js","scripts":{"prepare":"npm run build","test":"jest","build":"webpack --mode=production --node-env=production","dev":"webpack --watch"},"repository":{"type":"git","url":"github.com/NiuWeb/random-pool"},"keywords":["random","pool"],"author":{"name":"bygdle"},"license":"MIT","devDependencies":{"@babel/core":"^7.22.9","@babel/preset-env":"^7.22.9","@babel/preset-typescript":"^7.22.5","@types/jest":"^29.5.3","@webpack-cli/generators":"^3.0.7","babel-jest":"^29.6.1","jest":"^29.6.1","prettier":"^2.8.8","ts-loader":"^9.4.4","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"gitHead":"c25cc489093411291aa933d9fc5ec32e4f5339ca","_id":"@bygdle/random-pool@1.2.2","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-RNdHSPnjR/XHoxBkMkB9kNPbWqw/ljPzpWJCjuNXAwlrUMTqzV1CTm5t44864nNiyfxnd7hsC8uXgoUr1DJlJQ==","shasum":"43b00c8c60544697de1365dbad9ccba224fa0df1","tarball":"https://registry.npmjs.org/@bygdle/random-pool/-/random-pool-1.2.2.tgz","fileCount":16,"unpackedSize":14240,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDL9rtac1F8eqcIjn1sMSqEFvphWTW8sBKbaD90rvGAVgIhAIlL2kpAnVkXhhY057L6pPFjl/m4Apcg7B0jtLN0YvfM"}]},"_npmUser":{"name":"bygdle","email":"danielfgarciagomez@outlook.es"},"directories":{},"maintainers":[{"name":"bygdle","email":"danielfgarciagomez@outlook.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-pool_1.2.2_1689945038863_0.17440333266400176"},"_hasShrinkwrap":false},"1.2.3":{"name":"@bygdle/random-pool","version":"1.2.3","description":"Select random items from a pool of items","main":"dist/index.js","scripts":{"prepare":"npm run build","test":"jest","build":"webpack --mode=production --node-env=production","dev":"webpack --watch"},"repository":{"type":"git","url":"github.com/NiuWeb/random-pool"},"keywords":["random","pool"],"author":{"name":"bygdle"},"license":"MIT","devDependencies":{"@babel/core":"^7.22.9","@babel/preset-env":"^7.22.9","@babel/preset-typescript":"^7.22.5","@types/jest":"^29.5.3","@webpack-cli/generators":"^3.0.7","babel-jest":"^29.6.1","jest":"^29.6.1","prettier":"^2.8.8","ts-loader":"^9.4.4","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"types":"./dist/index.d.ts","gitHead":"4027ab7c5d82265517d9c91d813fed573c0d8130","_id":"@bygdle/random-pool@1.2.3","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-q53PRWMueMbTOJKKU4BfzXP9hPY8XCnPiyyiLe2tBWTX9qg4lIGmnH+3t1RYpwZPqJjqJAAivMLs0eGaY5zznA==","shasum":"903d4f4c3eefa123bfe9fd513283d726d03df545","tarball":"https://registry.npmjs.org/@bygdle/random-pool/-/random-pool-1.2.3.tgz","fileCount":17,"unpackedSize":15664,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHA73VZzS5wVTTqg1PpPyeopWKQL+KlGn6RPYIKMZJJtAiAGOdTfKRMeRo49ch3ks82N8S+EJMHsZrEGhFcMiabzlg=="}]},"_npmUser":{"name":"bygdle","email":"danielfgarciagomez@outlook.es"},"directories":{},"maintainers":[{"name":"bygdle","email":"danielfgarciagomez@outlook.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-pool_1.2.3_1689945371854_0.361720421390914"},"_hasShrinkwrap":false},"1.3.0":{"name":"@bygdle/random-pool","version":"1.3.0","description":"Select random items from a pool of items","main":"dist/index.js","scripts":{"prepare":"npm run build","test":"jest","build":"webpack --mode=production --node-env=production","dev":"webpack --watch"},"repository":{"type":"git","url":"github.com/NiuWeb/random-pool"},"keywords":["random","pool"],"author":{"name":"bygdle"},"license":"MIT","devDependencies":{"@babel/core":"^7.22.9","@babel/preset-env":"^7.22.9","@babel/preset-typescript":"^7.22.5","@types/jest":"^29.5.3","@webpack-cli/generators":"^3.0.7","babel-jest":"^29.6.1","jest":"^29.6.1","prettier":"^2.8.8","ts-loader":"^9.4.4","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"types":"./dist/index.d.ts","gitHead":"3d3209f784f504436978aaa3c184e2cb4fd5f7f2","_id":"@bygdle/random-pool@1.3.0","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-ck8vhY7i0943/FBe+qh1/EAHSyYFUTLvbnnfZDVvR0EAYXwcmY6RObvFvU66IdqNP14fqCHUpn01brPulF00TQ==","shasum":"c8554dac80477c7ec2de23a6654ea04c07633c86","tarball":"https://registry.npmjs.org/@bygdle/random-pool/-/random-pool-1.3.0.tgz","fileCount":17,"unpackedSize":16299,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFUVtrPOu+vBkFhjCOmD6bnWPlvrgQBeMiFPqObjyuCWAiABJvpiFE9JAhbe+XP+Cr9JVoMZtCTGftA82TNWv6cmKw=="}]},"_npmUser":{"name":"bygdle","email":"danielfgarciagomez@outlook.es"},"directories":{},"maintainers":[{"name":"bygdle","email":"danielfgarciagomez@outlook.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-pool_1.3.0_1689968352596_0.11097136692749343"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-17T18:59:15.108Z","1.0.0":"2023-07-17T18:59:15.432Z","modified":"2023-07-21T19:39:12.924Z","1.1.0":"2023-07-17T21:24:46.842Z","1.2.0":"2023-07-17T21:50:26.584Z","1.2.1":"2023-07-21T13:06:45.647Z","1.2.2":"2023-07-21T13:10:39.109Z","1.2.3":"2023-07-21T13:16:12.006Z","1.3.0":"2023-07-21T19:39:12.752Z"},"maintainers":[{"name":"bygdle","email":"danielfgarciagomez@outlook.es"}],"description":"Select random items from a pool of items","keywords":["random","pool"],"repository":{"type":"git","url":"github.com/NiuWeb/random-pool"},"author":{"name":"bygdle"},"license":"MIT","readme":"# random-pool\n\n[https://github.com/NiuWeb/random-pool](https://github.com/NiuWeb/random-pool)\n\nPicks random elements from a pool.\n\n## Usage\nThe basic usage of the library is the following:\n\n```ts\nimport { RandomPool } from \"@bygdle/random-pool\"\nconst pool = new RandomPool({\n  values: [[\"A\", 50], [\"B\", 25], [\"C\", 25]],\n})\n\n// A has 50% chance of being picked\n// B and C have 25% chance of being picked\nconst picked = pool.pick() \n```\nThe weights of the items does not have to add up to 100, the probability is computed based on the sum of the weights:\n\n```ts\nimport { RandomPool } from \"@bygdle/random-pool\"\nconst pool = new RandomPool({\n  values: [[\"A\", 100], [\"B\", 50], [\"C\", 50]],\n})\n\n// A has 50% chance of being picked\n// B and C have 25% chance of being picked\nconst picked = pool.pick() \n```\n\n## Dependent pools\nYou can configure the pool to remove items when they are picked, so it behaves like a dependent random variable:\n\n```ts\nimport { RandomPool } from \"@bygdle/random-pool\"\nconst pool = new RandomPool({\n  values: [[\"A\", 100], [\"B\", 50], [\"C\", 50]],\n  dependent: true\n})\n\n// At the first pick:\n// A has 50% chance of being picked\n// B and C have 25% chance of being picked\npool.pick() \n\n// At the second pick:\n// If A was picked at the first pick ->\n//   B and C have 50% chance of being picked\n// If B or C were picked at the first pick ->\n//   A has 75% chance of being picked, \n//   and the other one has 25% chance of being picked\npool.pick()\n\n// At the third pick:\n// The only remaining item is picked\npool.pick()\n\n// At the fourth pick:\n// The pool is empty, and an error is thrown\npool.pick()\n```\n","readmeFilename":"README.md"}