Realize points on a synthetic geometry with explicit random-state control
Source:R/synthetic_realization.R
sample.synthetic.geometry.RdCoordinates and sampling algorithms retain the existing version-1 draw order. With a seed or explicit state list, the caller's RNG kinds and seed presence/value are restored on success and errors. The opt-in current-stream mode instead advances the caller's stream. No statistical response or dataset identity is created.
Arguments
- geometry
A supported geometry component.
- sampling
A supported sampling component. Legacy G4 is excluded.
- n
Positive sample size, or
NULLfor fixed-size sampling.- seed
Nonnegative integer seed for standalone L'Ecuyer-CMRG sampling. Supply exactly one of
seedandrng.plan.- rng.plan
Optional list with exactly
version = 1L,orderequal to"sampling.frame"or"frame.sampling", andsamplingandframeRNG states. States are complete integer.Random.seedvectors for L'Ecuyer-CMRG or Mersenne-Twister with Inversion/Rejection.frameisNULLunless a random frame is requested. State headers retain R's binomial generator field when supported by the running R version; a newer state cannot be replayed on an R version that does not support it. Retry/substream selection belongs to the caller. The standalone seed assigns sampling its initial stream and the random frame the next independent stream. Alternatively,"current"consumes the current R stream directly, sampling before any random frame. This mode never resets RNG kinds or seed and supports the caller's selected generators, including Box-Muller's hidden cached normal value. Draws advance the stream even if a subsequent operation fails. Callset.seed()yourself when reproducibility from a known starting point is needed.
Value
A synthetic_geometry_sample list containing predictors, latent,
latent.mask, region, frame.matrix, the specifications, dimensions,
intrinsic.dim.by.region and codimension.by.region for simplex strata,
declared.regions, observed.regions, n, and sample (the original sampler payload). rng contains the
effective plan, states after each draw, and final.state for explicit
continuation by a caller. In current-stream mode the plan is "current";
returned state vectors are observations, not complete replay tokens for
generators with hidden state. A deterministic draw can leave these vectors
NULL if no seed exists. The result has no truth or response fields.
Examples
x <- sample.synthetic.geometry(synthetic.circle(),
synthetic.sampling.uniform.interval(0, 2 * pi), n = 8, seed = 7)
dim(x$predictors)
#> [1] 8 2