{"id":37184146,"url":"https://github.com/sergonie/wrand","last_synced_at":"2026-01-14T21:16:31.244Z","repository":{"id":52515285,"uuid":"361887725","full_name":"sergonie/wrand","owner":"sergonie","description":"Lightweight golang library for weighted random selection.","archived":false,"fork":false,"pushed_at":"2021-04-26T21:49:33.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-21T09:46:01.394Z","etag":null,"topics":["fast","go","golang","random","weighted"],"latest_commit_sha":null,"homepage":"","language":"Go","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/sergonie.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}},"created_at":"2021-04-26T20:38:55.000Z","updated_at":"2024-06-21T09:46:01.395Z","dependencies_parsed_at":"2022-09-26T17:50:45.906Z","dependency_job_id":null,"html_url":"https://github.com/sergonie/wrand","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sergonie/wrand","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergonie%2Fwrand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergonie%2Fwrand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergonie%2Fwrand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergonie%2Fwrand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergonie","download_url":"https://codeload.github.com/sergonie/wrand/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergonie%2Fwrand/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["fast","go","golang","random","weighted"],"created_at":"2026-01-14T21:16:30.359Z","updated_at":"2026-01-14T21:16:31.237Z","avatar_url":"https://github.com/sergonie.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WRAND\n\n[![Go](https://github.com/sergonie/wrand/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/sergonie/wrand/actions/workflows/go.yml)\n\nLightweight golang library for obtaining a weighted random item.\n\n## Installation\n\n```shell\ngo get -u github.com/sergonie/wrand\n```\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/sergonie/wrand\"\n)\n\nfunc main() {\n\tmyDataset := []struct {\n\t\tName   string\n\t\tWeight int\n\t}{\n\t\t{\n\t\t\tName:   \"Max\",\n\t\t\tWeight: 80,\n\t\t},\n\t\t{\n\t\t\tName:   \"El\",\n\t\t\tWeight: 110,\n\t\t},\n\t\t{\n\t\t\tName:   \"Gabriella\",\n\t\t\tWeight: 45,\n\t\t},\n\t}\n\n\titems := \u0026wrand.ItemsCollection{}\n\tfor k, v := range myDataset {\n\t\titems.Add(k, v.Weight)\n\t}\n\n\tselectedItem := wrand.NewPicker().Pick(items)\n\n\tfmt.Printf(\"Winner: %s\\n\", myDataset[selectedItem.Value].Name)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergonie%2Fwrand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergonie%2Fwrand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergonie%2Fwrand/lists"}