![]() Probability = scales::percent(p)) # A tibble: 10 x 2įor example, when someone gives us “8” as their random number, we need to determine whether that “8” should become a “1” or not (8% chance). Going back to our original distribution, we have the following probabilities for each number, which we can use to re-assign any probability, if necessary. Thankfully, if you are able to tolerate a few small inaccuracies, we can get pretty close to this solution without having to ask more than twice. But intead, we have our room full of people. This would be simple enough if we had access to a uniform random number generator (i.e. a random real number from 0 to 1). The other 92% of the time, it remains an 8. What this chart is telling us is that about 8% of the time someone gives you “8” as their random number, you need to convert it into a “1”, somehow. Labs(title = "Probability mass redistribution", Scale_alpha_continuous(limits = c(0, 1), range = c(0, 1)) Geom_text(aes(label = ifelse(p_redistributed = 0, "", scales::percent(p_redistributed, 2)))) Geom_tile(aes(alpha = p_redistributed, fill = as.factor(from))) Let’s take a closer/slower look at where exactly the mass is going: balanced_probabilities %>% Great! We now have a redistribution function. Labs(title = 'Balancing the "Human RNG distribution"', Ggplot(aes(x = key, y = p_redistributed * p_original)) This returns the following re-distribution: library(gganimate) Suffix = c("_redistributed", "_original")) We can then pass this problem to a solver, like the lpSolve package in R, combining the constraints we have created into a single matrix: # Make results reproducible. \] maximise_original_distribution_reuse % Labs(title = '"Pick a random number from 1-10"', Scale_y_continuous(labels = scales::percent_format(), Geom_col(aes(fill = as.factor(outcome))) Eventually you start to see that the pattern is not flat at all: library(tidyverse)Ĭount(outcome = round(pick_a_random_number_from_1_10)) %>% You continue to ask people and count their responses, rounding non-integers and ignoring answers from people who think that 1 to 10 includes 0. However, you start to wonder, is the number uniformly random? The easy thing to do is to ask someone “Hey, pick a random number from 1 to 10!”. All you have is a room of people.įor the sake of argument, let’s say this room has a little over 8500 students in it. But, let’s say you have to do this without access to coins, computers, radioactive material, or other such access to traditional (pseudo) random number generators. That is, an integer from 1 to 10 inclusive, with an equal chance (10%) of selecting each one. Imagine you have to generate a uniform random number from 1 to 10.
0 Comments
Leave a Reply. |