R version 4.4.0 alpha (2024-04-04 r86334 ucrt) Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(nor1mix) > > ## From: "Jenifer Boshes" > ## Date: Sun, 2 Dec 2007 20:16:28 -0700 > > ## ................ > > ## The use of sample(x, ...) inside rnorMix() typically was wrong when > ## x was of length one > > obj <- norMix(mu = c(1,0), sigma = c(5,1), w = c(.5,.5)) > > for(ss in round(runif(1000, min=0,max=1000))) { + set.seed(ss) + stopifnot(length(r <- rnorMix(1,obj)) == 1) + } > > cat('Time elapsed: ', proc.time(),'\n') # for ``statistical reasons'' Time elapsed: 0.1 0.15 0.2 NA NA > > proc.time() user system elapsed 0.10 0.15 0.20