R/runif.sphere.R

Defines functions runif.sphere

Documented in runif.sphere

runif.sphere <- function(n, win=sphwin(type="sphere")) {
  stopifnot(inherits(win, "sphwin") && win$type == "sphere")
  theta <- acos(runif(n, -1, 1))
  phi <- runif(n, 0, 2*pi)
  output <- cbind(theta, phi) * win$rad
  return(output)
}
baddstats/spherstat documentation built on Feb. 6, 2023, 1:45 a.m.