{"id":22088007,"url":"https://github.com/coatless-rpkg/sitmo","last_synced_at":"2025-12-12T01:03:57.596Z","repository":{"id":56934506,"uuid":"53080526","full_name":"coatless-rpkg/sitmo","owner":"coatless-rpkg","description":"Sitmo parallel random number engine headers in an R package","archived":false,"fork":false,"pushed_at":"2023-11-14T08:22:06.000Z","size":553,"stargazers_count":7,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-09T18:53:00.946Z","etag":null,"topics":["parallel","r","random-generation","rcpp"],"latest_commit_sha":null,"homepage":"http://r-pkg.thecoatlessprofessor.com/sitmo/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coatless-rpkg.png","metadata":{"files":{"readme":"README.Rmd","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}},"created_at":"2016-03-03T20:23:08.000Z","updated_at":"2023-11-14T07:32:10.000Z","dependencies_parsed_at":"2024-01-08T12:17:43.975Z","dependency_job_id":null,"html_url":"https://github.com/coatless-rpkg/sitmo","commit_stats":{"total_commits":74,"total_committers":5,"mean_commits":14.8,"dds":0.4864864864864865,"last_synced_commit":"b98bbfb4be968f33d29ba55bd71740eda45b24f4"},"previous_names":["coatless/sitmo"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/coatless-rpkg/sitmo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-rpkg%2Fsitmo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-rpkg%2Fsitmo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-rpkg%2Fsitmo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-rpkg%2Fsitmo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coatless-rpkg","download_url":"https://codeload.github.com/coatless-rpkg/sitmo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-rpkg%2Fsitmo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27673719,"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-12-11T02:00:11.302Z","response_time":56,"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":["parallel","r","random-generation","rcpp"],"created_at":"2024-12-01T02:07:20.563Z","updated_at":"2025-12-12T01:03:57.550Z","avatar_url":"https://github.com/coatless-rpkg.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput:\n  md_document:\n    variant: gfm\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/coatless-rpkg/sitmo/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/sitmo/actions/workflows/R-CMD-check.yaml)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/sitmo)](https://www.r-pkg.org/pkg/sitmo)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/sitmo)](https://cran.r-project.org/package=sitmo)\n\u003c!-- badges: end --\u003e\n  \n# `sitmo`: A header-only package for _R_ containing SITMO PPRNGs\n\nThe repository houses the `sitmo` R package for Parallel Psuedo Random Number Generation (PPRNG). The package provides a way to obtain the SITMO Consulting's PPRNG header files via **LinkTo**.\n\n## Installing `sitmo`\n\n`sitmo` is available on both CRAN (Stable) and GitHub (Development). Using\nCRAN to download and install `sitmo` is the preferred option as it is significantly\nmore stable vs. the GitHub version.\n\n### Stable (CRAN) Install Instructions\n\nTo install the package from CRAN, you can simply type:\n\n```r\ninstall.packages(\"sitmo\")\n```\n\nThe package will be installed and available in a similar fashion to\nother R packages. The main exception to this note is that to use `sitmo` to\ncreate a package you will need to acquire a compiler. This is detailed under \nthe development install instructions.\n\n### Development Install Instructions\n\nTo install the package, you must first have a compiler on your system that is\ncompatible with R.\n\nFor help on obtaining a compiler consult:\n\n-   [macOS](https://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-os-x/)\n-   [Windows](https://thecoatlessprofessor.com/programming/rcpp/install-rtools-for-rcpp/)\n\nWith a compiler in hand, one can then install the package from GitHub by:\n\n```{r, echo = T, eval = F}\ninstall.packages(\"devtools\")\n\ndevtools::install_github(\"coatless/sitmo\")\n```\n\n## Using `sitmo`\n\nThere are two ways to use `sitmo`. The first is to use `sitmo` in a standalone\nscript. The script is typically built using `sourceCpp()`. The second approach\nallows for `sitmo` to be used within an R package.\n\n### Standalone file usage\n\nWithin the `C++` file, the `sitmo` package provides an Rcpp plugins' \ndepends statement that must be included after `sitmo.h` header. This plugin\nstatement indicates that a dependency is `sitmo`.\n\n```cpp\n#include \u003cRcpp.h\u003e\n#include \u003csitmo.h\u003e \n// [[Rcpp::depends(sitmo)]]\n```\n\nTo use the two other engines, `threefry` and `vandercorput`, they must be \nloaded like:\n\n```cpp\n#include \u003cRcpp.h\u003e\n#include \u003cthreefry.h\u003e      // or use #include \u003cvandercorput.h\u003e\n// [[Rcpp::depends(sitmo)]]\n// [[Rcpp::plugins(cpp11)]]\n```\n\n#### `sitmo` Engine Example\n\nBelow is a hello world example meant to show a basic implementation of `sitmo`.\n\n```cpp\n#include \u003cRcpp.h\u003e\n#include \u003crandom\u003e  // C++11 RNG library\n#include \u003csitmo.h\u003e // SITMO PPRNG\n\n// Rcpp depends attribute is required for standalone use. \n// It is not needed if in package linking to the sitmo package (detailed next).\n// [[Rcpp::depends(sitmo)]]\n\n// [[Rcpp::export]]\nRcpp::NumericVector sitmo_draws_ex(unsigned int n) {\n  \n  Rcpp::NumericVector o(n);\n  \n  // Create a prng engine\n  sitmo::prng eng;\n  \n  // Draw from base engine\n  for (unsigned int i=0; i\u003c n ; ++i){\n    o(i) = eng();  \n  }\n\n  return o;\n}\n\n/*** R\nsitmo_draws_ex(5)\n*/\n```\n\n#### `threefry` Engine Example\n\nBelow is a hello world example meant to show a basic implementation of `threefry`.\nThis engine _requires_ C++11.\n\n```cpp\n#include \u003cRcpp.h\u003e\n#include \u003cthreefry.h\u003e\n\n// Rcpp depends attribute is required for standalone use. \n// It is not needed if in package linking to the sitmo package (detailed next).\n// [[Rcpp::depends(sitmo)]]\n\n// threefry requires access to a C++11 compatible compiler\n// [[Rcpp::plugins(cpp11)]]\n\n// [[Rcpp::export]]\nvoid threefry_draws_streaming(unsigned int n) {\n    sitmo::threefry eng1, eng2; \n \n    eng1.seed(0);  // reset the first engine (not really necessary)\n    eng2.seed(1);  // 2nd engine gets a different seed\n \n    Rcpp::Rcout \u003c\u003c \"\\nTwo independent streams.\\n\";\n    for (unsigned int i = 0; i \u003c n; ++i)\n        Rcpp::Rcout \u003c\u003c eng1() \u003c\u003c \" \" \u003c\u003c eng2() \u003c\u003c \"\\n\";\n}\n```\n\n#### `vandercorput` Engine Example\n\nBelow is a hello world example meant to show a basic implementation of `vandercorput`.\nThis engine _requires_ C++11.\n\n```cpp\n#include \u003cRcpp.h\u003e\n#include \u003cvandercorput.h\u003e\n\n// Rcpp depends attribute is required for standalone use. \n// It is not needed if in package linking to the sitmo package (detailed next).\n// [[Rcpp::depends(sitmo)]]\n\n// vandercorput requires access to a C++11 compatible compiler\n// [[Rcpp::plugins(cpp11)]]\n\n// [[Rcpp::export]]\nvoid vandercorput_draws_streaming(unsigned int n) {\n    sitmo::vandercorput eng;\n    for (unsigned int i = 0; i \u003c n; ++i)\n        Rcpp::Rcout \u003c\u003c eng() \u003c\u003c \"\\n\"; \n}\n```\n\n### Package usage\n\nTo use `sitmo` in your R package, modify the `DESCRIPTION` file by adding:\n\n    LinkingTo: Rcpp, sitmo\n    Imports:\n        Rcpp (\u003e= 0.12.11)\n\nTo use C++11's statistical distributions, you **may** want to add the \nfollowing to your `src/Makevars` and `src/Makevars.win` file:\n\n    CXX_STD = CXX11\n\nWithin a `C++` file in `src/`, then add:\n\n```{Rcpp, eval = FALSE}\n#include \u003cRcpp.h\u003e\n#include \u003csitmo.h\u003e      // SITMO for C++98 \u0026 C++11 PPRNG\n#include \u003cthreefry.h\u003e   // THREEFRY C++11-only PPRNG\n#include \u003cvandercorput\u003e // VANDERCORPUT C++11-only Low-discrepancy sequence\n```\n\nYou do _not_ need to add each header file. Pick and choose the appropriate\nengine for your needs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-rpkg%2Fsitmo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoatless-rpkg%2Fsitmo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-rpkg%2Fsitmo/lists"}