{"id":24143866,"url":"https://github.com/dnbaker/alias_sampler","last_synced_at":"2025-08-13T05:07:18.543Z","repository":{"id":94817985,"uuid":"227515903","full_name":"dnbaker/alias_sampler","owner":"dnbaker","description":null,"archived":false,"fork":false,"pushed_at":"2020-07-02T17:01:30.000Z","size":52,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-01T11:01:37.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnbaker.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-12-12T03:55:41.000Z","updated_at":"2023-05-10T21:51:02.000Z","dependencies_parsed_at":"2023-04-24T06:02:12.940Z","dependency_job_id":null,"html_url":"https://github.com/dnbaker/alias_sampler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dnbaker/alias_sampler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnbaker%2Falias_sampler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnbaker%2Falias_sampler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnbaker%2Falias_sampler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnbaker%2Falias_sampler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnbaker","download_url":"https://codeload.github.com/dnbaker/alias_sampler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnbaker%2Falias_sampler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270183606,"owners_count":24541341,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-01-12T05:45:44.134Z","updated_at":"2025-08-13T05:07:18.519Z","avatar_url":"https://github.com/dnbaker.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alias_sampler 🎭 [![Build Status](https://travis-ci.com/dnbaker/alias_sampler.svg?branch=master)](https://travis-ci.com/dnbaker/alias_sampler)\n\nAlias sampling, for sampling from discrete probability distributions in constant time.\n\nlibstdc++ uses binary search in a cumulative probability array, which both takes logarithmic time and pollutes the cache. This doesn't.\n\nAliasSampler uses [fastmod](https://lemire.me/blog/2019/02/08/faster-remainders-when-the-divisor-is-a-constant-beating-compilers-and-libdivide/), while MaskedAliasSampler pads to a power of two with items at probability 0 and uses a bitmask.\n\nThese samplers provide single samples (`sampler.sample()` or `sampler()`), a batch of samples (`sampler.sample(1000)`/`sampler(1000)`),\nor fills a range spanned by iterators with samples (`sampler.sample(vec.begin(), vec.end(), sampling_seed)`).\n\nSimilarly, uses blaze for vector multiplications if available, but not otherwise.\n\nIn order to make sampling threadsafe, pass `-DALIAS_THREADSAFE`, which will provide a separate RNG for each thread.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnbaker%2Falias_sampler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnbaker%2Falias_sampler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnbaker%2Falias_sampler/lists"}