search for: basedeck

Displaying 1 result from an estimated 1 matches for "basedeck".

Did you mean: babedec2
2012 Jun 15
2
Looking for Speed in a Toy Simulation Example
...<- 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)) singlecolor[i, ] <- sapply(currentdeck, function(inv) { length(unique(inv)) == 1 }) }...