## Introduction
I thinK! I've figured out RStudio!
I believe, after much trial and error, I figured out the in-class activity from the lecture I missed on 2026-09-08. I'm excited to attend lecture tomorrow evening!In this report, I am comparing the histograms of 10,000 dice rolls versus 10,000 weighted dice rolls.
## Methods
``` r
die <- 1:6
sample(die, size = 2, replace = FALSE)
## [1] 5 6
roll <- function() {
dice <- sample(die, size = 2, replace = TRUE)
sum(dice)
}
roll()
## [1] 4
set.seed(123)
rolls <- replicate(10000, roll())
length(rolls)
## [1] 10000
roll_weighted <- function() {
sample(die, size = 2, replace = TRUE, prob = c(1/8, 1/8, 1/8, 1/8, 1/8, 3/8)) |>
sum()
}
roll_weighted()
## [1] 8
set.seed(123)
rolls_weighted <- replicate(10000, roll_weighted())
length(rolls_weighted)
## [1] 10000
hist(rolls,
breaks = seq(1.5, 12.5, by = 1))
Distribution of 10,000 Simulated Rolls
This histogram shows the frequency of the sum when 2 6-sided dice are rolled. The sum of 7 occurs the most because it has the most combinations when rolled compared to any other number.
hist(rolls_weighted,
breaks = seq(1.5, 12.5, by = 1))
Distrobution of 10,000 Simulated Weighted Rolls
This histograms shows the frequency when 2 6-sided dice that have a weight on the 6 are rolled 10,000 times. Compared to the earlier histogram, because both dice are equally-weighted, the chances of getting sums involving a 6 increase.