runif_cube {uniformly}R Documentation

Uniform sampling on/in cube

Description

Uniform sampling on or in a cube (arbitrary dimension).

Usage

runif_in_cube(n, d, O = rep(0, d), r = 1)

runif_on_cube(n, d, O = rep(0, d), r = 1)

Arguments

n

number of simulations

d

dimension

O

center of the cube

r

radius (half-side) of the cube

Value

The simulations in a n times d matrix.

Examples

sims <- runif_on_cube(60, d = 2)
plot(sims, xlim = c(-1,1), ylim = c(-1,1), pch = 19, asp = 1)
sims <- runif_in_cube(50, d = 3)
library(scatterplot3d)
scatterplot3d(sims, pch = 19, highlight.3d = TRUE, asp = 1)

[Package uniformly version 0.5.0 Index]