powered by
Uniform sampling in a simplex (arbitrary dimension).
runif_in_simplex(n, simplex)
The simulations in a n times d matrix.
n
d
number of simulations
a (d+1) times d matrix giving the vertices of the simplex (rows)
(d+1)
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)
Run the code above in your browser using DataLab