Skip to content

Instantly share code, notes, and snippets.

@sugi2000
Created May 31, 2017 14:46
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 sugi2000/f4e8666d53c9827c55a86520306a196c to your computer and use it in GitHub Desktop.
Save sugi2000/f4e8666d53c9827c55a86520306a196c to your computer and use it in GitHub Desktop.
Shishita 四下(しした)の出目の確率分布
dice <- c(1:6)
result <- 1:100000
for (i in 1:100000) {
a <- sample(dice, 1, TRUE)
b <- sample(dice, 1, TRUE)
c <- a + b
d <- c %% 4
if (d == 0) d <- 4
result[i] <- d
}
hist(result, col='gray', main='shi-shita', breaks=c(0,1,2,3,4), freq = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment