Displaying 1 result from an estimated 1 matches for "singlecolor".
2012 Jun 15
2
Looking for Speed in a Toy Simulation Example
...####################################
noplayer <- 6
simlength <- 1e+05
decklength <- 5 * noplayer
#################################################
## Variant 1 ##
#################################################
## Initialize matrix to hold results
singlecolor <- matrix(NA, simlength, noplayer)
## construct the deck to sample from
basedeck <- rep(1:4, 13)
## This one uses split to create the individual hands
set.seed(7777)
system.time({
for (i in 1:simlength) {
currentdeck <- split(sample(basedeck, decklength), rep(1:noplayer, 5))
single...