Created
May 31, 2017 14:46
-
-
Save sugi2000/f4e8666d53c9827c55a86520306a196c to your computer and use it in GitHub Desktop.
Shishita 四下(しした)の出目の確率分布
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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