powered by
Uniform sampling on a spherical cap (in dimension 3).
runif_on_sphericalCap(n, r = 1, h)
The simulations in a n times 3 matrix.
n
3
number of simulations
radius of the sphere
height of the cap
sims <- runif_on_sphericalCap(500, r = 2, h = 1) if (FALSE) { library(rgl) spheres3d(0, 0, 0, radius = 2, color = "red", alpha = 0.5) points3d(sims)}
Run the code above in your browser using DataLab