% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/algorithm-dec.R
\name{sample_random}
\alias{sample_random}
\alias{random}
\title{Point Cloud Decimation Algorithm}
\usage{
random(density, use_pulse = FALSE)
}
\arguments{
\item{density}{numeric. The desired output density.}

\item{use_pulse}{logical. Decimate by removing random pulses instead of random points (requires running
\link{retrieve_pulses} first)}
}
\description{
This function is made to be used in \link{decimate_points}. It implements an algorithm that
randomly removes points or pulses to reach the desired density over the area.
}
\examples{
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las = readLAS(LASfile, select = "xyz")

# Reach a pulse density of 1 on the overall dataset
thinned1 = decimate_points(las, random(1))
plot(rasterize_density(las))
plot(rasterize_density(thinned1))
}
\seealso{
Other point cloud decimation algorithms: 
\code{\link{sample_homogenize}},
\code{\link{sample_maxima}},
\code{\link{sample_per_voxel}}
}
\concept{point cloud decimation algorithms}
