powered by
Uniform sampling in a p-ball (arbitrary dimension).
runif_in_pball(n, d, p, r = 1)
The simulations in a n times d matrix.
n
d
number of simulations
dimension
exponent in the p-norm, a positive number
positive number, the radius
sims <- runif_in_pball(500, d = 2, p = 1) plot(sims, xlim = c(-1, 1), ylim = c(-1, 1), asp = 1)
Run the code above in your browser using DataLab