{"id":18651119,"url":"https://github.com/hrkings/weightedrandomselectionlib","last_synced_at":"2025-07-13T02:10:27.916Z","repository":{"id":111717681,"uuid":"213519911","full_name":"HRKings/WeightedRandomSelectionLib","owner":"HRKings","description":"A efficient weighted random selection library","archived":false,"fork":false,"pushed_at":"2022-01-15T06:42:21.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T21:37:53.579Z","etag":null,"topics":["gacha","random","selection","selector","weighted","weights"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HRKings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-08T01:19:28.000Z","updated_at":"2022-01-15T06:18:49.000Z","dependencies_parsed_at":"2023-03-13T13:34:10.824Z","dependency_job_id":null,"html_url":"https://github.com/HRKings/WeightedRandomSelectionLib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HRKings/WeightedRandomSelectionLib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HRKings%2FWeightedRandomSelectionLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HRKings%2FWeightedRandomSelectionLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HRKings%2FWeightedRandomSelectionLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HRKings%2FWeightedRandomSelectionLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HRKings","download_url":"https://codeload.github.com/HRKings/WeightedRandomSelectionLib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HRKings%2FWeightedRandomSelectionLib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265080256,"owners_count":23708121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gacha","random","selection","selector","weighted","weights"],"created_at":"2024-11-07T06:48:27.702Z","updated_at":"2025-07-13T02:10:27.894Z","avatar_url":"https://github.com/HRKings.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Weighted Random Selection Lib\n\nWeighted Random Selection Lib is a library implementation of a weighted random selection algorithm built on top of .NET 5 to reach almost any platform\n\nThe implementation uses efficient algorithms to deliver fast selections (like Binary Search)\n\n## Example\nBellow is an example of how the library can be used\n\nThe code will select 10 of the available choices based on their weights and display one by line on the console\n\n```c#\nusing WeightedRandomSelectionLib;\n\nclass Program {\n\tstatic void Main (string[] args) \n\t{\n\t\tWeightedRandomSelector\u003cstring\u003e selector = new WeightedRandomSelector\u003cstring\u003e();\n\n\t\tselector.Add(\"Choice 1\", 0.8);\n\t\tselector.Add(\"Choice 2\", 15.0);\n\t\tselector.Add(\"Choice 3\", 62.21);\n\t\tselector.Add(\"Choice 4\", 32.5);\n\t\tselector.Add(\"Choice 5\", 70.0);\n\n\n\t\tforeach (string i in selector.SelectMultiple (10))\n\t\t{\n\t\t\tConsole.WriteLine(i);\n\t\t}\n\t}\n}\n```\n\nObs.: You can also add a WeightedItem collection for more control (or to add more than one item at time), you can also pass this collection in the constructor if you want to.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrkings%2Fweightedrandomselectionlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrkings%2Fweightedrandomselectionlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrkings%2Fweightedrandomselectionlib/lists"}