runif_in_simplex {uniformly} | R Documentation |
Uniform sampling in a simplex
Description
Uniform sampling in a simplex (arbitrary dimension).
Usage
runif_in_simplex(n, simplex)
Arguments
n |
number of simulations |
simplex |
a |
Value
The simulations in a n
times d
matrix.
Note
In dimension 3, you can use runif_in_tetrahedron
instead.
Examples
simplex <- rbind(c(0,0,0), c(1,0,0), c(1,1,0), c(1,1,2))
sims <- runif_in_simplex(1000, simplex)
library(rgl)
points3d(sims)
[Package uniformly version 0.5.0 Index]