{"id":16412023,"url":"https://github.com/amirmasoudabdol/baaraan","last_synced_at":"2026-05-16T15:33:45.479Z","repository":{"id":70085833,"uuid":"221889019","full_name":"amirmasoudabdol/baaraan","owner":"amirmasoudabdol","description":"Collection of missing multivariate random number distributions for Modern C++ with STL-like API.","archived":false,"fork":false,"pushed_at":"2021-06-07T13:05:00.000Z","size":634,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-16T15:22:22.859Z","etag":null,"topics":["modern-cpp","multivariate-distributions","random-number-generators","statistics"],"latest_commit_sha":null,"homepage":"https://baaraan.amirmasoudabdol.name","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amirmasoudabdol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/cmake/baaraan-config.cmake.in","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-15T09:22:15.000Z","updated_at":"2022-03-18T08:23:49.000Z","dependencies_parsed_at":"2023-03-11T07:54:16.180Z","dependency_job_id":null,"html_url":"https://github.com/amirmasoudabdol/baaraan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amirmasoudabdol/baaraan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirmasoudabdol%2Fbaaraan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirmasoudabdol%2Fbaaraan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirmasoudabdol%2Fbaaraan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirmasoudabdol%2Fbaaraan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amirmasoudabdol","download_url":"https://codeload.github.com/amirmasoudabdol/baaraan/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirmasoudabdol%2Fbaaraan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33108182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["modern-cpp","multivariate-distributions","random-number-generators","statistics"],"created_at":"2024-10-11T06:47:21.011Z","updated_at":"2026-05-16T15:33:45.458Z","avatar_url":"https://github.com/amirmasoudabdol.png","language":"C++","funding_links":["https://github.com/sponsors/amirmasoudabdol"],"categories":[],"sub_categories":[],"readme":"[![macOS](https://github.com/amirmasoudabdol/baaraan/workflows/macOS/badge.svg)](https://github.com/amirmasoudabdol/baaraan/actions?query=workflow%3AmacOS)\n[![Ubuntu](https://github.com/amirmasoudabdol/baaraan/workflows/Ubuntu/badge.svg)](https://github.com/amirmasoudabdol/baaraan/actions?query=workflow%3AUbuntu)\n\n\n\u003e 🚨 **Disclaimer:** I am in the process of testing and open-sourcing baaraan, please do not use it in production unless you have done the test yourself! \n\u003e \n\u003e Please let me know if you ran into any problems or have any suggestions! 😊 🙏🏼\n\n\u003cimg src=\"docs/img/logo.png\" width=\"250\" align=\"right\"/\u003e\n\n# Baaraan\n\nBaaraan (Farsi: باران, [_baran_](https://en.wiktionary.org/wiki/باران), | bârân |) is a collection of missing multivariate random number distributions for Modern C++ with [STL](https://en.cppreference.com/w/cpp/numeric/random)-like API. For the start, some of the more important and useful distributions are implemented and tested, e.g., Multivariate Normal Distribution, and I am hopping to slowly expand the list of the distributions, and maybe even add some noise functions to the library later on.\n\nFor the most part, Baaraan's random number distributions are sharing the same interface and implementation details as their STL counterparts. First advantages of this is that they will look and behave very familiar. Moreover, they can adapt to your setup, for example, they will work with different URNGs out of the box. \n\nI use [Armadillo](http://arma.sourceforge.net) as the backend Linear Algebra library. Mainly, I'm using `arma::vec` and `arma::mat` as default `VectorType`  and `MatrixType` types. This is shared between all multi-variate distributions.\n\nFor the actual probability distribution implementation, i.e., density, probability, cumulative functions, I am planning to use [Boost](https://www.boost.org/doc/libs/1_62_0/libs/math/doc/html/math_toolkit/dist_ref.html) architecture and interface. Boost uses several [non-member functions](https://www.boost.org/doc/libs/1_62_0/libs/math/doc/html/math_toolkit/dist_ref/nmp.html) are being used to query different properties of a distribution.\n\n## Available Distributions\n\n**Multivariate:**\n- [Multivariate Normal](https://en.wikipedia.org/wiki/Multivariate_normal_distribution)\n- [Multivariate t-Student Distibution](https://en.wikipedia.org/wiki/Multivariate_t-distribution?wprov=sfti1)\n\n**Truncated:**\n- [Truncated Normal](https://en.wikipedia.org/wiki/Truncated_normal_distribution)\n- [Truncated Multivariate Normal](https://en.wikipedia.org/wiki/Truncated_normal_distribution)\n\n**Rectified:**\n- [Rectified Normal](https://en.wikipedia.org/wiki/Rectified_Gaussian_distribution)\n\n## Documentation\n\nFor full documentation and implementation details please visit, [https://baaraan.amirmasoudabdol.name](https://baaraan.amirmasoudabdol.name).\n\n## Installation\n\nYou can add the entire baaraan source tree to your project and therefore use CMake's `add_subdirectory` command to integrate it to your project. So, after copying baaraan to `your-project/baaraan`, your `CMakeLists.txt` should look like this.\n\n```cmake\nadd_subdirectory(baaraan)\n\ninclude_directories(baaraan/include/)\n\ntarget_link_libraries(your-project baaraan) \n```\n\nAlternatively, you can build and install baaraan first, and use CMake's `find_package` command to add it to your project:\n\n```bash\ngit clone https://github.com/amirmasoudabdol/baaraan\ncd baaraan; mkdir build; cd build\ncmake .. \u0026\u0026 make\nmake install\n```\n\nNow, you can simply use the `find_package` and if everything is setup correctly, you should be able to compile your projects and use baaraan in your project.\n\n```cmake\nfind_package(baaraan)\n\n# don't forget to link it to your executable or library\ntarget_link_libraries(your-project baaraan) \n```\n\n## Example\n\nAfter installing and linking baaraan to your project, you should be able to simply `#include` any distributions and use it as follow:\n\n```cpp\n#include \u003ciostream\u003e\n#include \"baaraan/dists/mvnorm_distribution.h\"\n\nusing namespace baaraan;\n\nint main(int argc, char const *argv[])\n{\n\tarma::vec means {1, 2, 3};\n\tarma::mat sigma{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};\n\n\tstd::mt19937 gen(42);\n\tmvnorm_distribution\u003cdouble\u003e mvnorm{means, sigma};\n\n\tstd::cout \u003c\u003c mvnorm(gen) \u003c\u003c std::endl;\n\n\treturn 0;\n}\n```\n\nYour `CMakeLists.txt` should look something like this:\n\n```cmake\ncmake_minimum_required(VERSION 3.20)\nproject(rain)\n\nset(CMAKE_CXX_STANDARD 14)\n\nfind_package(baaraan)\n\nadd_executable(rain main.cpp)\ntarget_link_libraries(rain baaraan)\n```\n\n\n# Misc.\n\n## License \n\nBaaraan project is licensed under the [Apache License 2.0](https://opensource.org/licenses/Apache-2.0). Baaraan can be used in proprietary software, without releasing the source code. However, any software that incorporates or distributes Baaraan in source or binary form must include a readable copy of the attributions in the NOTICE.txt file that comes with Baaraan.\n\n## TODO\n\n- [ ] Implement more tests\n- [ ] Implement more distributions\n- [ ] Add more documentations\n- [ ] Add more examples\n- [ ] Add support for single header include\n- [ ] Implement some concurrent random number generation \n\n## Contribution\n\nAs I mentioned, this is an experimental library and I am still working on its design and future plan. Please feel free to open an [issue](https://github.com/amirmasoudabdol/baaraan/issues), or maybe a [discussion thread](https://github.com/amirmasoudabdol/baaraan/discussions) if you have any ideas/requests regarding the library.\n\n## Support\n\nIf you enjoy using `baaraan`, please consider supporting it on [GitHub](https://github.com/sponsors/amirmasoudabdol). You can sponsor me monthly, or make a one-time donation! 🤗","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirmasoudabdol%2Fbaaraan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famirmasoudabdol%2Fbaaraan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirmasoudabdol%2Fbaaraan/lists"}