1
0
Fork
You've already forked xoshiro
0
Fast random number generator for R https://rstub.codeberg.page/xoshiro/
  • C 65.6%
  • R 34.4%
2025年07月06日 18:30:09 +02:00
external Initial commit 2025年07月06日 18:09:59 +02:00
inst/include Initial commit 2025年07月06日 18:09:59 +02:00
man Initial commit 2025年07月06日 18:09:59 +02:00
R Initial commit 2025年07月06日 18:09:59 +02:00
src Initial commit 2025年07月06日 18:09:59 +02:00
.gitignore Initial commit 2025年07月06日 18:09:59 +02:00
.Rbuildignore Initial commit 2025年07月06日 18:09:59 +02:00
_pkgdown.yml Add pkgdown configuration 2025年07月06日 18:26:40 +02:00
DESCRIPTION Initial commit 2025年07月06日 18:09:59 +02:00
LICENSE.md Initial commit 2025年07月06日 18:09:59 +02:00
NAMESPACE Initial commit 2025年07月06日 18:09:59 +02:00
README.md Mention automatic registering in README. 2025年07月06日 18:30:09 +02:00
README.Rmd Mention automatic registering in README. 2025年07月06日 18:30:09 +02:00
xoshiro.Rproj Initial commit 2025年07月06日 18:09:59 +02:00

xoshiro

Lifecycle: experimental

The goal of xoshiro is to make the Xoshiro256++ PRNG available to R in a form that is suitable for parallel processing.

Installation

You can install the development version of xoshiro like so:

remotes::install_git("https://codeberg.org/rstub/xoshiro/")

Example

This is a basic example which shows you how to solve a common problem:

library(xoshiro)
library(future.apply)
#> Loading required package: future
plan(multisession)
void <- future:::parallel_rng_kind(
 kind = "user",
 set_kind = base::RNGkind,
 next_stream = xoshiro:::next_stream,
 next_substream = xoshiro:::next_substream,
 is_seed = xoshiro:::is_xoshiro256pp_seed,
 as_seed = xoshiro:::as_xoshiro256pp_seed
)
# identical results
future_sapply(1:8, \(x){sum(runif(1e6))}, future.packages = "xoshiro", future.seed = 42)
#> [1] 500076.5 500328.9 500158.6 499847.2 500373.7 499792.5 499822.4 499186.2
future_sapply(1:8, \(x){sum(runif(1e6))}, future.packages = "xoshiro", future.seed = 42)
#> [1] 500076.5 500328.9 500158.6 499847.2 500373.7 499792.5 499822.4 499186.2

Note that loading the package automatically registers a user-defined RNG for both uniform and normal distribution:

RNGkind()
#> [1] "user-supplied" "user-supplied" "Rejection"

This implies that all standard functions like set.seed, runif or rnorm cn be used to interact with the RNG.