
Native multivariate normal sampling (reproduces MASS::mvrnorm)
Source:R/mass_native.R
morie_mvrnorm.RdDraws from \(N(\mu, \Sigma)\) using the symmetric eigen
decomposition, matching MASS::mvrnorm exactly – including its
RNG consumption (rnorm(p * n) in the same order), so under a
common seed the draws are identical.
Examples
if (requireNamespace("MASS", quietly = TRUE)) {
set.seed(1)
morie_mvrnorm(3, mu = c(0, 0), Sigma = diag(2))
}
#> [,1] [,2]
#> [1,] -1.5952808 -0.6264538
#> [2,] -0.3295078 0.1836433
#> [3,] 0.8204684 -0.8356286