Skip to content

Instantly share code, notes, and snippets.

@jalapic
Created December 30, 2018 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalapic/a3ae8d96684efe847bfddeee1a256b85 to your computer and use it in GitHub Desktop.
Save jalapic/a3ae8d96684efe847bfddeee1a256b85 to your computer and use it in GitHub Desktop.
17 consonants out of scrabble tile distribution
## Drawing consonants in a row
tiles <- c(rep("V", 44), rep("C", 56)) # 42 vowels + 2 blanks, 56 consonants
# combined vowels and blanks into "V" as don't care about difference for this
# loop 1 million times
res<-NULL
for(i in 1:1000000){
draw <- sample(tiles, 17, F)
res[[i]]<-length(draw[draw=="C"])
}
library(ggplot2)
ggplot(data.frame(value=res),
aes(x=value)) +
geom_histogram(color="darkseagreen",
fill="lightseagreen")+
xlab("Number of consonants drawn")
sum(res==17) # number of times got 17 consonants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment