% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rxrandom.R
\name{rxWithSeed}
\alias{rxWithSeed}
\alias{rxWithPreserveSeed}
\title{Preserved seed and possibly set the seed}
\usage{
rxWithSeed(
  seed,
  code,
  rxseed = rxGetSeed(),
  kind = "default",
  normal.kind = "default",
  sample.kind = "default"
)

rxWithPreserveSeed(code)
}
\arguments{
\item{seed}{R seed to use for the session}

\item{code}{Is the code to evaluate}

\item{rxseed}{is the rxode2 seed that is being preserved}

\item{kind}{character or \code{NULL}.  If \code{kind} is a character
    string, set \R's RNG to the kind desired.  Use \code{"default"} to
    return to the \R default.  See \sQuote{Details} for the
    interpretation of \code{NULL}.}

\item{normal.kind}{character string or \code{NULL}.  If it is a character
    string, set the method of Normal generation.  Use \code{"default"}
    to return to the \R default.  \code{NULL} makes no change.}

\item{sample.kind}{character string or \code{NULL}.  If it is a character
    string, set the method of discrete uniform generation (used in 
    \code{\link[base]{sample}}, for instance).  Use \code{"default"} to return to 
    the \R default.  \code{NULL} makes no change.}
}
\value{
returns whatever the code is returning
}
\description{
Preserved seed and possibly set the seed
}
\examples{

rxGetSeed()
rxWithSeed(1, {
   print(rxGetSeed())
   rxnorm()
   print(rxGetSeed())
   rxnorm()
}, rxseed=3)

}
\seealso{
rxGetSeed, rxSetSeed
}
