Skip to content

Instantly share code, notes, and snippets.

View adames's full-sized avatar

Adames Hodelin adames

  • New York, NY
View GitHub Profile
@jacopotarantino
jacopotarantino / die-fairness.js
Created December 9, 2019 21:59
is my die balanced?
// determines number of times you should roll a die to determine if it is "fair"
const find_number_of_rolls = (number_of_sides, required_confidence) => {
const allowed_deviation = 1 - required_confidence
const expected_value_per_side = 1/allowed_deviation
const rolls = expected_value_per_side * number_of_sides
return Math.round(rolls)
}
// rolls array takes the form: value_of_side(int)[]

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?