rball | R Documentation |
Random vector generation uniformly in the unitary ball.
rball(n = 1, p = 2)
n |
the number of samples requested |
p |
dimension of the unitary sphere |
The function rball
is an interface to C routines, which make calls to
subroutines from BLAS.
If n = 1
a p
-dimensional vector, otherwise a matrix of n
rows of random vectors.
Hormann, W., Leydold, J., Derflinger, G. (2004). Automatic Nonuniform Random Variate Generation. Springer, New York.
runif
# generate the sample
z <- rball(n = 500)
# scatterplot of a random sample of 500 points uniformly distributed
# in the unitary ball
par(pty = "s")
plot(z, xlab = "x", ylab = "y")
title("500 points in the ball", font.main = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.