{"id":"alexeylegasov63/weightedrandom","name":"weightedrandom","scope":"alexeylegasov63","platform":"roblox","description":"A module for weighted random selection with dynamic probability adjustment.","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"Apache-2.0","licenseRating":"safe","licenseCaveats":["Modified files must carry a notice of changes. If the package ships a NOTICE file, its attributions must be preserved."],"licenseVerified":false,"dependencies":{},"integrity":"cc5e44d26b0a169fd764a5b3faff090adb8530f0138fbcd34ae30e8f91e3db41","likes":0,"downloads":0,"install":"forest install alexeylegasov63/weightedrandom","url":"https://forest.dev/p/roblox/alexeylegasov63/weightedrandom","files":"https://api.forest.dev/ai/package/roblox/alexeylegasov63/weightedrandom/files","readme":"# WeightedRandom.luau\r\n\r\n`WeightedRandom.luau` is a Roblox (Luau) module that allows selecting random items based on their weights, with optional dynamic probability adjustments on each pick.\r\n\r\n## Features\r\n\r\n* **Add items** with a unique ID, initial weight, and any associated data.\r\n* **Weighted selection** — items with higher weights have a greater chance of being picked.\r\n* **Optional weight growth** — automatically increase the weight of all items each time `getRandom` is called.\r\n* **Probability balancing** — drastically reduce the chance of the selected item to avoid repeats.\r\n\r\n## Example\r\n\r\n```lua\r\nlocal WeightedRandom = require(path.to.WeightedRandom)\r\n\r\nlocal randomizer = WeightedRandom.new(true) -- true = enable auto-adjustment\r\nrandomizer:addItem(\"floor1\", 1, {name = \"First Floor\"})\r\nrandomizer:addItem(\"floor2\", 1, {name = \"Second Floor\"})\r\n\r\nlocal picked = randomizer:getRandom()\r\nprint(\"Picked:\", picked.id, picked.data.name)\r\n```\r\n\r\n\r\n## Wally\r\n\r\n\r\n","readmeTruncated":false}