Movatterモバイル変換


[0]ホーム

URL:


Title:Parallel Pseudo Random Number Generator (PPRNG) 'sitmo' HeaderFiles
Version:2.0.2
Description:Provided within are two high quality and fast PPRNGs that may be used in an 'OpenMP' parallel environment. In addition, there is a generator for one dimensional low-discrepancy sequence. The objective of this library to consolidate the distribution of the 'sitmo' (C++98 & C++11), 'threefry' and 'vandercorput' (C++11-only) engines on CRAN by enabling others to link to the header files inside of 'sitmo' instead of including a copy of each engine within their individual package. Lastly, the package contains example implementations using the 'sitmo' package and three accompanying vignette that provide additional information.
Depends:R (≥ 3.2.0)
URL:https://github.com/coatless/sitmo,http://thecoatlessprofessor.com/projects/sitmo/,https://github.com/stdfin/random/
BugReports:https://github.com/coatless/sitmo/issues
License:MIT + file LICENSE
LinkingTo:Rcpp
Imports:Rcpp (≥ 0.12.13)
RoxygenNote:7.1.1
Suggests:knitr, rmarkdown, ggplot2
VignetteBuilder:knitr
Encoding:UTF-8
NeedsCompilation:yes
Packaged:2021-10-13 03:57:03 UTC; ronin
Author:James BalamutaORCID iD [aut, cre, cph], Thijs van den Berg [aut, cph], Ralf Stubner [ctb]
Maintainer:James Balamuta <balamut2@illinois.edu>
Repository:CRAN
Date/Publication:2021-10-13 04:50:02 UTC

sitmo: Parallel Pseudo Random Number Generator (PPRNG) 'sitmo' Header Files

Description

Provided within are two high quality and fast PPRNGs that may beused in an 'OpenMP' parallel environment. In addition, there is a generatorfor one dimensional low-discrepancy sequence. The objective of this libraryto consolidate the distribution of the 'sitmo' (C++98 & C++11), 'threefry' and'vandercorput' (C++11-only) engines on CRAN by enabling others to link to theheader files inside of 'sitmo' instead of including a copy of each enginewithin their individual package. Lastly, the package contains exampleimplementations using the 'sitmo' package and three accompanying vignette thatprovide additional information.

Author(s)

Maintainer: James Balamutabalamut2@illinois.edu (ORCID) [copyright holder]

Authors:

Other contributors:

See Also

Useful links:


Random Uniform Number Generator using base R

Description

The function provides an alternative implementation of random uniform distributionsampling using R's rng scope.

Usage

runif_r(n, min = 0, max = 1)

Arguments

n

Anunsigned integer denoting the number of realizations to generate.

min

Adouble indicating the minimuma value in the uniform's interval\left[a,b\right]

max

Adouble indicating the maximumb value in the uniform's interval\left[a,b\right]

Examples

set.seed(134)b = runif_r(10)

Random Uniform Number Generator with sitmo

Description

The function provides an implementation of sampling from a random uniform distribution

Usage

runif_sitmo(n, min = 0, max = 1, seed = 1L)

Arguments

n

Anunsigned integer denoting the number of realizations to generate.

min

Adouble indicating the minimuma value in the uniform's interval\left[a,b\right]

max

Adouble indicating the maximumb value in the uniform's interval\left[a,b\right]

seed

A specialunsigned integer containing a single seed.

Value

Anumeric vector containing the realizations.

Examples

a = runif_sitmo(10)

Example RNG Draws with sitmo

Description

Shows a basic setup and use case for sitmo.

Usage

sitmo_draws(n)

Arguments

n

Aunsigned int is a .

Value

Avec with random sequences.

Examples

n = 10a = sitmo_draws(n)

Example Seed Set and RNG Draws with sitmo

Description

Shows how to set a seed in sitmo.

Usage

sitmo_engine_reset(n, seed)

Arguments

n

Anunsigned int that dictates how many realizations occur.

seed

Anunsigned int that controls the rng seed.

Value

Amatrix with random sequences.

Examples

n = 10a = sitmo_engine_reset(n, 1337)isTRUE(all.equal(a[,1],a[,2]))

Example Seed Set and RNG Draws with sitmo

Description

Shows how to set a seed in sitmo.

Usage

sitmo_engine_seed(n, seed)

Arguments

n

Anunsigned int that dictates how many realizations occur.

seed

Anunsigned int that controls the rng seed.

Value

Avector with random sequences.

Examples

n = 10a = sitmo_engine_seed(n, 1337)b = sitmo_engine_seed(n, 1337)c = sitmo_engine_seed(n, 1338)isTRUE(all.equal(a,b))isTRUE(all.equal(a,c))

Test Generation using sitmo and C++11

Description

The function provides an implementation of creating realizations from the default engine.

Usage

sitmo_parallel(n, seeds)

Arguments

n

Anunsigned integer denoting the number of realizations to generate.

seeds

Avec containing a list of seeds. Each seed is run on its own core.

Details

The following function's true power is only accessible on platforms that support OpenMP (e.g. Windows and Linux).However, it does provide a very good example as to how to make ones code applicable across multiple platforms.

With this being said, how we determine how many cores to split the generation to is governed by the number of seeds supplied.In the event that one is using OS X, only the first seed supplied is used.

Value

Avec containing the realizations.

Examples

a = sitmo_parallel(10, c(1))b = sitmo_parallel(10, c(1,2))c = sitmo_parallel(10, c(1,2))# True on only OS X or systems without openmpisTRUE(all.equal(a,b))isTRUE(all.equal(b,c))

Two RNG engines running side-by-side

Description

Shows how to create two separate RNGs and increase them together.

Usage

sitmo_two_seeds(n, seeds)

Arguments

n

Anunsigned int that dictates how many realizations occur.

seeds

Avec containing two integers greater than 0.

Value

Amatrix with random sequences.

Examples

n = 10a = sitmo_two_seeds(n, c(1337, 1338))b = sitmo_two_seeds(n, c(1337, 1337))isTRUE(all.equal(a[,1], a[,2]))isTRUE(all.equal(b[,1], b[,2]))isTRUE(all.equal(a[,1], b[,1]))

[8]ページ先頭

©2009-2025 Movatter.jp