{"id":19703529,"url":"https://github.com/lukencode/randomchoice","last_synced_at":"2025-04-29T14:30:50.547Z","repository":{"id":138388276,"uuid":"2168744","full_name":"lukencode/RandomChoice","owner":"lukencode","description":"An simple library for making those hard (well just random) choices","archived":false,"fork":false,"pushed_at":"2011-09-02T08:24:00.000Z","size":104,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T17:51:08.569Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukencode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-08-07T13:35:32.000Z","updated_at":"2017-04-02T17:37:36.000Z","dependencies_parsed_at":"2023-03-11T08:15:10.012Z","dependency_job_id":null,"html_url":"https://github.com/lukencode/RandomChoice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukencode%2FRandomChoice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukencode%2FRandomChoice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukencode%2FRandomChoice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukencode%2FRandomChoice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukencode","download_url":"https://codeload.github.com/lukencode/RandomChoice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251518824,"owners_count":21602216,"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":[],"created_at":"2024-11-11T21:18:08.961Z","updated_at":"2025-04-29T14:30:46.958Z","avatar_url":"https://github.com/lukencode.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"A little helper library that given an (optionaly weighted) list of methods chooses one at random. Useful if you are making a game or something I guess.\n\n```csharp\n\t//add actions to the selector\n\tvar selector = RandomSelector\n\t\t\t.AddAction(() =\u003e { doSomething(); })\n\t\t\t.AddAction(() =\u003e { doSomeOtherThing(); });\n\n\tselector.Choose(); //randomly picks an action to run\n```\n\nYou can also optionally weight each action.\n\n```csharp\n\t//add actions to the selector (must add up to 1.0)\n\tvar selctor = RandomSelector\n\t\t\t.AddAction(0.7, () =\u003e { probablyDoThis(); })\n\t\t\t.AddAction(0.2, () =\u003e { maybeDoThis(); })\n\t\t\t.AddAction(0.1, () =\u003e { smallChanceOfThis(); });\n\n\tselector.Choose(); //randomly picks an action to run\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukencode%2Frandomchoice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukencode%2Frandomchoice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukencode%2Frandomchoice/lists"}