{"id":32175466,"url":"https://github.com/rabauke/trng4","last_synced_at":"2026-02-18T22:02:14.730Z","repository":{"id":47275788,"uuid":"2670882","full_name":"rabauke/trng4","owner":"rabauke","description":"state of the art C++ pseudo-random number generator library for sequential and parallel Monte Carlo simulations","archived":false,"fork":false,"pushed_at":"2024-11-23T22:20:39.000Z","size":17914,"stargazers_count":120,"open_issues_count":2,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-11-10T06:21:19.879Z","etag":null,"topics":["c-plus-plus","computational-finance","computational-physics","hpc","library","monte-carlo-methods","pseudo-random-generator"],"latest_commit_sha":null,"homepage":"https://www.numbercrunch.de/trng/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rabauke.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-10-29T13:52:21.000Z","updated_at":"2025-07-09T07:44:53.000Z","dependencies_parsed_at":"2024-04-13T17:29:52.318Z","dependency_job_id":"83447acc-5814-4da9-ab91-46fe71254662","html_url":"https://github.com/rabauke/trng4","commit_stats":{"total_commits":150,"total_committers":5,"mean_commits":30.0,"dds":0.1466666666666666,"last_synced_commit":"efdb3cfdb589a1f34ce4dfde85a8a068451018e3"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/rabauke/trng4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabauke%2Ftrng4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabauke%2Ftrng4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabauke%2Ftrng4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabauke%2Ftrng4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rabauke","download_url":"https://codeload.github.com/rabauke/trng4/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabauke%2Ftrng4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29596329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T20:59:56.587Z","status":"ssl_error","status_checked_at":"2026-02-18T20:58:41.434Z","response_time":162,"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":["c-plus-plus","computational-finance","computational-physics","hpc","library","monte-carlo-methods","pseudo-random-generator"],"created_at":"2025-10-21T19:39:04.645Z","updated_at":"2026-02-18T22:02:14.724Z","avatar_url":"https://github.com/rabauke.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TRNG - A modern C++ pseudo random number generator library\n\n## Key features\n\n* fully compatible with the C++11 random number facility as defined in [`\u003crandom\u003e`](https://en.cppreference.com/w/cpp/header/random)\n* implements various pseudo random number algorithms\n* supports multiple streams of random numbers for parallel (multithreaded) applications\n* does not depend on a specific parallelization technique, may be used with any threading library or MPI\n* pseudo random numbers can be sampled from many different discrete and continuous distributions\n* employs the CMake build system and features [CMake package](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html) support\n* bindings for the R programming language provided via [rTRNG package](https://cran.r-project.org/web/packages/rTRNG/index.html), see also [this blog post](https://mirai-solutions.ch/news/2019/06/10/rTRNG-avanced-parallel-RNG-R/) or [this presentation](https://docs.microsoft.com/en-US/events/user-international-r-user-conferences-user-international-r-user-2017-conference/rtrng-advanced-parallel-random-number-generation-in-r)\n\n## Example\n\nTRNG classes can be used as a drop-in replacement for classes declared in the `random` header \n file of the C++ standard library.  In addition, the TRNG random number generators provide `jump` and `split` methods for constructing independent streams of pseudo random numbers for parallel Monte Carlo simulations.  The following code illustrates the use of TRNG pseudo random number generators for the parallel [Monte Carlo](https://en.wikipedia.org/wiki/Monte_Carlo_method) calculation of pi.\n\n```c++\n#include \u003ccstdlib\u003e\n#include \u003ciostream\u003e\n#include \u003comp.h\u003e\n#include \u003ctrng/yarn2.hpp\u003e\n#include \u003ctrng/uniform01_dist.hpp\u003e\n\nint main() {\n  const long samples{1000000l};  // total number of points in square\n  long in{0l};                   // number of points in circle\n  // distribute workload over all processes and make a global reduction\n#pragma omp parallel reduction(+ : in) default(none)\n  {\n    trng::yarn2 r;                          // random number engine\n    const int size{omp_get_num_threads()};  // get total number of processes\n    const int rank{omp_get_thread_num()};   // get rank of current process\n    trng::uniform01_dist\u003c\u003e u;               // random number distribution\n    r.jump(2 * (rank * samples / size));    // jump ahead\n    // throw random points into square\n    for (long i{rank * samples / size}; i \u003c (rank + 1) * samples / size; ++i) {\n      const double x{u(r)}, y{u(r)};  // choose random x- and y-coordinates\n      if (x * x + y * y \u003c= 1.0)       // is point in circle?\n        ++in;                         // increase thread-local counter\n    }\n  }\n  // print result\n  std::cout \u003c\u003c \"pi = \" \u003c\u003c 4.0 * in / samples \u003c\u003c std::endl;\n  return EXIT_SUCCESS;\n}\n```\n\n## Documentation\n\nFor installation instructions and further documentation see the trng.pdf file in the\ndoc directory. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabauke%2Ftrng4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frabauke%2Ftrng4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabauke%2Ftrng4/lists"}