% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/random.R
\name{rhypersphere}
\alias{rhypersphere}
\title{Hypersphere}
\usage{
rhypersphere(n, dim = 2, radius = 1, center = rep(0, dim), type = "boundary")
}
\arguments{
\item{n}{number of observations to simulate.}

\item{dim}{dimension of the hypersphere.}

\item{radius}{radius of the hypersphere.}

\item{center}{center of  the hypersphere.}

\item{type}{character; if \code{"boundary"} (default) then random variates 
are simulated from the hypersphere. If \code{"inside"}, the random
variates are points lying inside the hypersphere. If \code{"non-uniform"}, 
then random variates are non-uniform and are simulated from the inner part
of the hypersphere by making the radius a uniform random variable
between \code{0} and \code{radius}.}
}
\value{
The function returns a matrix whose rows are random variates 
(when \code{n > 1}) or a vector (when \code{n = 1}).
}
\description{
Simulates uniform random variates from the hypersphere.
}
\examples{
set.seed(123)
# Get 5 random uniform variates from 3D hypersphere
# of radius 10 centered at (2, 3, 1)
rhypersphere(n = 5, dim = 3, radius = 10, center = c(2, 3, 1))

}
