{"id":20248558,"url":"https://github.com/ndsvw/fluent-random-picker","last_synced_at":"2025-04-05T15:07:34.045Z","repository":{"id":48818017,"uuid":"358149991","full_name":"ndsvw/Fluent-Random-Picker","owner":"ndsvw","description":"Fluent Random Picker is a nice, performant, fluent way to pick random values. Probabilities can be specified, values can be weighted.","archived":false,"fork":false,"pushed_at":"2025-03-08T07:23:19.000Z","size":385,"stargazers_count":40,"open_issues_count":7,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T14:11:19.497Z","etag":null,"topics":["choose","csharp","fluent","hacktoberfest","hacktoberfest2023","outof","pick","picker","probability","random"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/FluentRandomPicker","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ndsvw.png","metadata":{"files":{"readme":"README-Advanced.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2021-04-15T06:22:33.000Z","updated_at":"2025-03-08T07:23:16.000Z","dependencies_parsed_at":"2023-09-26T22:25:11.883Z","dependency_job_id":"4f8769d7-957e-4fb1-994a-2cc1ce6ec355","html_url":"https://github.com/ndsvw/Fluent-Random-Picker","commit_stats":{"total_commits":268,"total_committers":4,"mean_commits":67.0,"dds":0.1977611940298507,"last_synced_commit":"6fed470364b901907a93c0c4b6a522189cfc9e50"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndsvw%2FFluent-Random-Picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndsvw%2FFluent-Random-Picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndsvw%2FFluent-Random-Picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndsvw%2FFluent-Random-Picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndsvw","download_url":"https://codeload.github.com/ndsvw/Fluent-Random-Picker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353745,"owners_count":20925329,"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":["choose","csharp","fluent","hacktoberfest","hacktoberfest2023","outof","pick","picker","probability","random"],"created_at":"2024-11-14T09:48:37.393Z","updated_at":"2025-04-05T15:07:34.019Z","avatar_url":"https://github.com/ndsvw.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fluent Random Picker: Advanced\n\n## Specifying a seed\n```c#\nvar seed = 1234567;\n\nvar value1 = Out.Of(seed).Values(new[] { 1, 2, 3, 4 }).PickOne();\nvar value2 = Out.Of(seed).Values(new[] { 1, 2, 3, 4 }).PickOne();\n// value1 and value2 are always equal.\n```\n\n## Using a secure RNG\nThe default random number generator uses System.Random, which is not cryptographically secure.\n\nThis is how you make Fluent Random Picker use an implementation based on the [cryptographically strong RandomNumberGenerator class](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.randomnumbergenerator?view=net-7.0).\n\n```c#\nvar secureRng = new FluentRandomPicker.Random.SecureRandomNumberGenerator();\nvar value = Out.Of(secureRng).Values(new[] { 1, 2, 3, 4 }).PickOne();\n```\n\n## Using a custom RNG\n\nCreate a class that implements `IRandomNumberGenerator` and pass it to the `Of()` method:\n\n```c#\npublic class MyCustomRandomNumberGenerator : IRandomNumberGenerator\n{\n    public double NextDouble()\n    {\n        // ...\n    }\n\n    public int NextInt()\n    {\n        // ...\n    }\n\n    public int NextInt(int n)\n    {\n        // ...\n    }\n\n    public int NextInt(int min, int max)\n    {\n        // ...\n    }\n}\n\nvar customRng = new MyCustomRandomNumberGenerator();\nvar value = Out.Of(customRng).Values(new[] { 1, 2, 3, 4 }).PickOne();\n// value gets picked via a specified random number generator.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndsvw%2Ffluent-random-picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndsvw%2Ffluent-random-picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndsvw%2Ffluent-random-picker/lists"}