The bootstrap answers "how much could this number move?" without a formula. Draw a resample of the data, the same size and with replacement (sample(x, replace = TRUE)), so some values appear twice and others not at all. Compute the statistic on it. Repeat a thousand times with replicate(1000, ...) or map_dbl(1:1000, ...). The spread of those results shows the uncertainty, and quantile(results, c(0.025, 0.975)) gives a 95 percent interval.
Two rules keep it honest: resample each group from its own values when comparing groups, and resample whole rows, not columns separately.
Simulation works the same way for processes: describe one run with random draws (runif(), rnorm(), sample()), repeat it many times, and count how often something happens. Set a seed so the numbers repeat; with thousands of runs, a different seed moves the answer only a little, so the checker allows a small tolerance where the order of draws is up to you.
A bootstrap interval for a mean, and a simulated probability.