powered by
Uniform sampling on a spherical triangle (in dimension 3).
runif_on_stri(n, r = 1, v1, v2, v3)
The simulations in a n times 3 matrix.
n
3
number of simulations
radius
vertices
# sampling on the first orthant: sims <- runif_on_stri(100, v1 = c(1, 0, 0), v2 = c(0, 1, 0), v3 = c(0, 0, 1)) if (FALSE) { library(rgl) spheres3d(0, 0, 0, color = "red", alpha = 0.5) points3d(sims)}
Run the code above in your browser using DataLab