% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/draw.R
\name{draw}
\alias{draw}
\alias{draw.dbd}
\title{Draw from a sampling design}
\usage{
draw(design, ...)

\method{draw}{dbd}(design, ...)
}
\arguments{
\item{design}{A \code{dbd} design object.}

\item{...}{Additional arguments passed to methods. \code{draw.dbd} accepts \code{sample_id} (integer). If
\code{sample_id} is \code{0L}, returns a random sample (default).}
}
\value{
a vector of sample indices.
}
\description{
Draw from a sampling design

Draw a sample from a distributionally balanced design
}
\section{Functions}{
\itemize{
\item \code{draw()}: draw generic

}}
\examples{
set.seed(12345);
N = 1000L;
n = 100L;
prob = rep(n / N, N);
xs = matrix(runif(N * 2), ncol = 2);

# Construct dbd design using tactical configuration
design = dbd_tc(
  n,
  xs,
  annealing_temp = 0.1,
  annealing_cooling = 0.999,
  max_iter = 1e5L
);
s = draw(design); # Draw sample from design
plot(xs[, 1], xs[, 2], pch = ifelse(sample_to_indicator(s, N), 19, 1));


}
