{"id":18046673,"url":"https://github.com/ltla/aarand","last_synced_at":"2025-04-10T04:53:45.324Z","repository":{"id":45260138,"uuid":"404221228","full_name":"LTLA/aarand","owner":"LTLA","description":"Aaron's random distributions for C++","archived":false,"fork":false,"pushed_at":"2024-06-03T21:43:20.000Z","size":387,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T06:04:58.253Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ltla.github.io/aarand/","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/LTLA.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":"2021-09-08T05:23:29.000Z","updated_at":"2024-07-24T01:11:20.000Z","dependencies_parsed_at":"2024-06-01T21:55:42.194Z","dependency_job_id":null,"html_url":"https://github.com/LTLA/aarand","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTLA%2Faarand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTLA%2Faarand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTLA%2Faarand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTLA%2Faarand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LTLA","download_url":"https://codeload.github.com/LTLA/aarand/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161255,"owners_count":21057553,"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-10-30T19:08:27.053Z","updated_at":"2025-04-10T04:53:45.297Z","avatar_url":"https://github.com/LTLA.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aaron's random distributions in C++\n\n![Unit tests](https://github.com/LTLA/aarand/actions/workflows/run-tests.yaml/badge.svg)\n![Documentation](https://github.com/LTLA/aarand/actions/workflows/doxygenate.yaml/badge.svg)\n[![codecov](https://codecov.io/gh/LTLA/aarand/branch/master/graph/badge.svg?token=6I3UBJLHSO)](https://codecov.io/gh/LTLA/aarand)\n\n## Overview\n\nThis library implements distribution functions to convert random numbers from C++11 (P)RNGs into samples of the relevant distribution.\nIt provides implementations of some of the standard distribution functions in `\u003crandom\u003e`, namely the uniform and normal distributions.\nWhy is a separate library necessary?\nBecause the standard functions are not guaranteed to give the same result across different library implementations - \nsee [discussion here](https://stackoverflow.com/questions/24550963/stl-random-distributions-and-portability) - \nand I don't want to drag Boost into my project dependencies.\n\n## Quick start\n\nUsage is pretty simple - just plug in your favorite PRNG into desired distribution function:\n\n```cpp\n#include \"aarand/aarand.hpp\"\n#include \u003crandom\u003e\n#include \u003ciostream\u003e\n\nint main() {\n    std::mt19937_64 rng(42);\n    double val = aarand::standard_uniform(rng);\n    std::cout \u003c\u003c \"Uniform value is: \" \u003c\u003c val \u003c\u003c std::endl;\n\n    auto paired = aarand::standard_normal(rng);\n    std::cout \u003c\u003c \"Normal values are: \" \u003c\u003c paired.first \u003c\u003c \", \" \u003c\u003c paired.second \u003c\u003c std::endl;\n    return 0;\n}\n```\n\nCheck out the [reference documentation](https://ltla.github.io/aarand) for more details.\n\n## Building projects\n\n### CMake with `FetchContent`\n\nIf you're already using CMake, you can add something like this to your `CMakeLists.txt`:\n\n```cmake\ninclude(FetchContent)\n\nFetchContent_Declare(\n  aarand\n  GIT_REPOSITORY https://github.com/LTLA/aarand\n  GIT_TAG master # or any version of interest\n)\n\nFetchContent_MakeAvailable(aarand)\n```\n\nAnd then:\n\n```cmake\ntarget_link_libraries(myexe aarand)\n\ntarget_link_libraries(mylib aarand)\n```\n\n### CMake with `find_package()`\n\nTo install the library, clone a suitable version of this repository and run:\n\n```sh\nmkdir build \u0026\u0026 cd build\ncmake .. -DAARAND_TESTS=OFF\ncmake --build . --target install\n```\n\nThen we can just use `find_package()` as usual:\n\n```cmake\nfind_package(ltla_aarand CONFIG REQUIRED)\ntarget_link_libraries(mylib PRIVATE ltla::aarand)\n```\n\n### Manual\n\nCopy and paste the [`aarand.hpp`](include/aarand/aarand.hpp) header file into your project and `#include` it as appropriate. \n\n## Available distributions\n\nCurrently, only the bare bones are available:\n\n- Standard uniform distribution (`standard_uniform`)\n- Standard normal distribution (`standard_normal`)\n- Standard exponential distribution (`standard_exponential`)\n- Discrete uniform distribution (`discrete_uniform`)\n- Shuffling an input vector (`shuffle`)\n- Sampling from an input vector or from an integer bound (`sample`)\n\nContributions are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltla%2Faarand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fltla%2Faarand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltla%2Faarand/lists"}