lotteryLightning-fast, zero-dependency weighted random allocation for Python. ⚡ Quick Startbashpython📖 API lottery(n: int, weights: dict[str, int]) -> dict[str, int] 表格Parameter Type Description n int ≥ 0 Total number of allocations dict[str, int] weights Non-negative integer weights (at least one > 0) dict[str, int] Returns Actual counts per key summing to n Examplepython🔍 Why lottery?Zero dependencies – only the Python standard libraryBlazing fast – 1 000 000 allocations in ~50 ms on CPython 3.11 (M1 Mac)Reproducible – set your own seed via random.seed python❓ FAQ<details>
<summary>Can I use float weights?</summary>Scale them to integers first:python</details><details>
<summary>Need exact proportions without random error?</summary>We plan to ship a deterministic allocator ( lottery.exact ) in v1.1.0. Until then, use lottery for statistical sampling.</details>
Raw data
{
"_id": null,
"home_page": null,
"name": "lottery-tool",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "random, weighted, lottery, distribution",
"author": null,
"author_email": "Your Name <you@example.com>",
"download_url": "https://files.pythonhosted.org/packages/1c/26/7159e58588ae758143d411f0acf92a5aba3f8f893f7a2ced7220f98190a1/lottery_tool-1.0.3.tar.gz",
"platform": null,
"description": "lotteryLightning-fast, zero-dependency weighted random allocation for Python. \u26a1 Quick Startbashpython\ud83d\udcd6 API lottery(n: int, weights: dict[str, int]) -> dict[str, int] \u8868\u683cParameter Type Description n int \u2265 0 Total number of allocations dict[str, int] weights Non-negative integer weights (at least one > 0) dict[str, int] Returns Actual counts per key summing to n Examplepython\ud83d\udd0d Why lottery?Zero dependencies \u2013 only the Python standard libraryBlazing fast \u2013 1 000 000 allocations in ~50 ms on CPython 3.11 (M1 Mac)Reproducible \u2013 set your own seed via random.seed python\u2753 FAQ<details>\n<summary>Can I use float weights?</summary>Scale them to integers first:python</details><details>\n<summary>Need exact proportions without random error?</summary>We plan to ship a deterministic allocator ( lottery.exact ) in v1.1.0. Until then, use lottery for statistical sampling.</details>\n",
"bugtrack_url": null,
"license": null,
"summary": "Tiny library for weighted random allocation",
"version": "1.0.3",
"project_urls": null,
"split_keywords": [
"random",
" weighted",
" lottery",
" distribution"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f728361dfaa82c4fc034c58183fb2b2edddcdb095fdd7e1c43b8d10f2c48c6fa",
"md5": "173b8133aac6991a9a87886a8d32a9fd",
"sha256": "ab16b1ae27718dce516b81059c9b54cb4718c96a859477629c67bf1cf3db11a3"
},
"downloads": -1,
"filename": "lottery_tool-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "173b8133aac6991a9a87886a8d32a9fd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 2453,
"upload_time": "2025-08-13T07:11:45",
"upload_time_iso_8601": "2025-08-13T07:11:45.246169Z",
"url": "https://files.pythonhosted.org/packages/f7/28/361dfaa82c4fc034c58183fb2b2edddcdb095fdd7e1c43b8d10f2c48c6fa/lottery_tool-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1c267159e58588ae758143d411f0acf92a5aba3f8f893f7a2ced7220f98190a1",
"md5": "a6c3cc39309eddc6ed5c75eb01077004",
"sha256": "f2385bd619f2e5b7aead067aa310677a07a02cf0494d8865540ebe40cc9ebb91"
},
"downloads": -1,
"filename": "lottery_tool-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "a6c3cc39309eddc6ed5c75eb01077004",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 2143,
"upload_time": "2025-08-13T07:11:46",
"upload_time_iso_8601": "2025-08-13T07:11:46.618633Z",
"url": "https://files.pythonhosted.org/packages/1c/26/7159e58588ae758143d411f0acf92a5aba3f8f893f7a2ced7220f98190a1/lottery_tool-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-13 07:11:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "lottery-tool"
}