R/ppp_n.R

Defines functions ppp_n

Documented in ppp_n

#' Simulate specific number of points from a homogeneous Poisson Point Process over (t_min, t_max]
#'
#' @description
#'   `r lifecycle::badge("deprecated")`
#' Use `ppp_exactly_n` instead.
#' @param size (int) the number of points to be simulated
#' @param range_t (vector, double) min and max of the time interval
#' @param rng_stream an `rstream` object
#'
#' @return a vector of event times of size `size`
#' @export
#' @keywords internal
#' @examples
#' x <- ppp_n(size = 10, range_t = c(0, 10))
ppp_n <- function(size, range_t = c(0, 10), rng_stream = NULL) {
  lifecycle::deprecate_warn(when = "0.5.0", what = "ppp_n()", with = "ppp_exactly_n()")
  U <- rng_stream_runif(size = size, minimum = range_t[1], maximum = range_t[2], rng_stream = rng_stream)
  if (size == 1) {
    return(U)
  }
  return(U[order(U, method = "shell")])
}

Try the nhppp package in your browser

Any scripts or data that you put into this service are public.

nhppp documentation built on Oct. 30, 2024, 9:28 a.m.