runif_cube: Uniform sampling on/in cube

Description Usage Arguments Value Examples

Description

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

Usage

1
2
3
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

1
2
3
4
5
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)

stla/uniformly documentation built on Aug. 10, 2018, 7:03 a.m.