Hacker News new | past | comments | ask | show | jobs | submit login
How thick is a three-sided coin? (jasmcole.com)
133 points by notmysql_ on Nov 28, 2022 | hide | past | favorite | 85 comments



Somewhat related, but amusing: "Ask Siri" includes a ~1/6000 chance of "Siri, flip me a coin" returning "The coin landed on its edge!"


Built in house advantage!!


I wonder if it’s true randomness sourced from something physical or a programmed probability.


I'm not sure anyone would notice a difference, especially with an interface like Siri where you can't easily flip enough coins to create a statistical distribution. And even then, pseudo-randomness would mean there's a seed, but that's probably shared with all other users (and likely not only for coin flipping), so I guess from your perspective there won't be a difference.


I don't know about iOS/Siri in particular, but Linux these days has good sources of entropy that can make for good randomness. And I'm not sure why you believe that Siri's random seed would be shared with anyone?


Only slightly related to this: I am amazed by the creativity employed by people trying to play D&D in prison. Since gambling is disallowed, dice are considered contraband. So they do things like modify pencil stubs (2 dead ends).

D&D turns out to be a reasonably good exercise in delayed gratification, an essential life skill many people need in order to successfully rehabilitate.


Interesting, I've played "tabletop RPG" (not D&D, homebrew) on vacations with my cousins, and we used coins, 6-sided dices, and sometimes (when we played while hiking) the DM was just counting quickly in his mind from a random number up or down (modulo N) and the player was saying STOP to get the number.


In one of my best "tabletop" RPG session, we had no dice, no character sheets, just two coins. We upgraded to a D6 mid-game when someone found one lying around.

Wasn't D&D though, the rules (most of them made up) were particularly suited to that sort of play: lots of storytelling and brutal combat.


You should check out Dungeon World (or any Apocalypse World derivatives) - every role is 2d6+ability modifier, and results are always 10+ for complete success, 7-9 for success but with a caveat, and <=6 as a failure.

You're allowed to do anything that "makes sense" given the fiction, and it is so much more storytelling focused than D&D etc.


I'm sure we could come up with a few ways of generating entropy given what is available in a prison. Bear in mind this is for D&D so need not be completely formally random.

You can easily create a reasonable n-gon (for low n) on card or paper and add an axle from wood or whatever is to hand and you have a Dn spinner. D3, 4, 5, 6, 8, and perhaps 10 and 12 will work too - yes more than the usual but why not?

If you have paper and pen and something that will give you heads/tails ie 0/1 then use binary and generate tables of numbers and use them one by one. Other bases and simple devices can be used to get tables for a desired "die" max value.


Two people pick 1-6, add them, mod 6, add 1. This should get you even chances of a number 1-6.


So to get 1-6 you only need two sources of 1-6?



I think the point is that we're not really good at being random, but combining two uncorrelated "random" draws into one gets something that will seem pretty random without closer inspection.


The point is that if a player needs a 6, they will always pick a 6. It's hard enough for people to come up with something random, but even harder if they know what number they need. Put two people opposed picking a number like this and it becomes random ish.


Well, dnd is largely cooperative: if you want to get a 6, I probably also want you to have a six. And if we're not even assuming that we are motivated to produce random results, than I seriously question whether such a simple rule would fix matters.


You are probably a DM and get how it works. Get the dice out for effect - they are a weapon too!

The whole point of DnD n that is it is fantasy ie thinking and talking about something that is not real. How you deal with fantasy is up to you.

Worrying about formalality is generally not a good approach to dealing with phantasy for obvious reasons.


In a game like dnd, you can't trust the player to pick a random number. So two sides who don't trust each other can generate a random number together.


The comments on this Vice video about people playing D&D in prison say people built dice out of bread or toilet paper. I would probably try to select random numbers from a sheet of random numbers like the Rand Corporation's random number book.

https://www.youtube.com/watch?v=_kDseTCNGyA


Learning "delayed gratification" is actually learning to appreciate dreams.

The dream of the cake vs the actual cake.

It's a really freaky shift of consciousness when you think about it. A whole culture trained to prefer dreamcakes over realcakes. To prefer dreams over reality.


Related to this, the classic "marshmallow test," where they left a kid alone with a marshmallow, and told them if they could hold off from eating it they'd get two later.

The standard interpretation of the original results was that a skill at delayed gratification led to better outcomes in life.

A replication of the study found that the effect nearly completely disappears once you correctly account for their socio-economic background. [1]

It also strongly supported the criticism that the lower socio-economic kids may have actually been making a logical choice to take the first marshmallow -- many of them had grown up with a lack of reliable adults and a lack of trust that future dreams will come true. Under that worldview, it makes sense to take the bird in the hand over the two in the bush.

Preferring dreams over reality is a luxury mostly permitted to those whose dreams have a reasonable chance of coming true, and a cushion to hand on when they don't.

1. https://www.theatlantic.com/family/archive/2018/06/marshmall...


Yep.

It’s not a marshmallow test, it’s a wealth test. Surprise, wealthy kids have better prospects.


Another important point : dreamcakes are much easier and cheaper to manufacture than realcakes.


dice are regularly made in prison from toothpaste and toilet paper. I've used some impressive examples of such


So... wait, what's the answer? Did I miss that somewhere?


Looking at the “better model” graph https://jasmcole.files.wordpress.com/2022/09/image-16.png — a “coin” with a thickness of nearly the diameter ratio ~0.85. Note h is half the thickness (r is more obviously half the diameter).


In the comments, someone asked a similar question:

> So what should the value of h be?

To which the author replied:

> It's about the journey, not the destination

Also, the fit they did for lambda was based on simulations, not actual "coin" tosses. So the exact answer for h/r probably wouldn't be very helpful.


I used the same Matter.js for a game project I was working on and I would definitely not consider it a scientific physics simulation. It eventually got the job done for my 2d golfing game with some workarounds and I appreciate having a JS first physics simulation library, but it was a bit buggy even for some pretty simple scenarios.

Doesn't seem like it's getting regular updates to the core physics anymore despite a lot of open issues and pull requests (although I do see two very minor git commits from this calendar year).


The 3-sided coin cannot work, the probability to fall over depends on the surface conditions.

For 1d3 roll 1d6 and divide by 2.


Given the nature of the question, an answer that includes parameterization on the relevant "surface conditions" would be perfectly acceptable and well within recreational mathematics bounds.


Or buy 1d3 dice: https://duckduckgo.com/?q=1d3+dice

Edit: apparently for some 1d3 designs it is difficult to roll them fairly: as per https://news.ycombinator.com/item?id=33778669


One of the hits for that search:

https://boardgamegeek.com/thread/1673702/roll-1d3/page/2

Is just a six sided die with three edges rounded off.


You can use any fair dN as a fair dN-X. Just roll, and if you roll bigger than N-X, just discard and roll again (Don't do modulo division unless it's an exact multiple)


You can also use any fair dN as a fair dN+X, by rolling ceil(log_N(N+X)) times and interpreting the result as a base-N number. (This is commonly done in D&D: instead of rolling a d100, you roll two d10s.) For example, say you want to roll a d20, but all you have is a coin. Flip the coin five times, producing a 5-bit integer (again discarding if the sum is not an exact multiple of N+X). A weirder example would be using a d6 to simulate a d100: ceil(log6(100)) = 3, so roll 3 times, then compute 36*r0 + 6*r1 + r2.

Edit: Even more generally, you can use any set of fair dice. Imagine you have a d2, d4, and d6, and you want to simulate a d40. Roll the d6 and multiply by 4*2; roll the d4 and multiply by 2; then roll (flip) the d2. The resulting sum is a fair roll in the range (0, 48]. This is a significant improvement over rolling a d6 three times: you can roll all of the dice together, and you're much less likely to need a reroll.


Interesting. I'm going to have to build a table to convince myself that the 2/4/6 example works. I'm not saying your wrong - just that combinatorial math (or really math beyond programmer stuff) isn't something I'm an expert in.

The bit I'm having trouble with...aren't you missing the low end of the range?

Like say you roll a 1 (the lowest possible roll), you'd get, if I understand right, you'd get 14 + 12 + 1*1 = 7.

Maybe this works if you subtract one from each roll so they can roll 0?


yes, you have to subtract one from each roll


The best part about d&d, is that the dice really don’t matter too much if you have a fun dm


Also it depends more on the rotational axis; if instead of flipping it you basically spin the coin, the likelihood of landing on the edge side is enhanced --if it's landing on a flat surface.


Totally ignoring angular momentum.


Not at all, that's contained in the second model. That's why the "potential well" is so small on the edge compared to the sides, because momentum easily pushes the coin past the edge.


The second model attempts to account for rotation but it doesn't account for varying angular velocities. Look at the variables, no new variables are included (unless you count the poorly defined constant). Does a coin "flip" that is a simple drop have the same odds as a fastly rotating coin? What if the flip is along the verticle axis instead of a horizontal axis or at angle in between?


At one point I spent some time in a very similar space, modelling how you would make a fair 4-sided or 5-sided die, by varying the depth of a d6 and appropriately labeling the faces. You would end up with 2 square faces and 4 rectangular faces, and vary the aspect ration of the rectangles to get fairness.

So a d4 would have 1 & 2 on the square faces, and 3 - 3 - 4 - 4 on the rectangular faces; this would require flattening the die.

A d5 would have 1 & 1 on the square faces, and 2 - 3 - 4 - 5 on the rectangular faces; this would require stretching the die to even out the probabilities.

I did an analysis similar to this, using the solid angle subtended by the faces, but the "bouncing" model is obviously much more rigorous and I'm curious to apply it to this case as well.


Why wouldn't a d4 just be a triangular pyramid (tetrahedron?)


That's what a standard d4 would look like, but GP was inventing a problem for exploration, as is standard practice in mathematics


Aren't all coins 3 sided coins?


Yes, better title would be "How thick is a fair three-sided coin?"


Getting a fair coin toss from a weighted coin is a fun mental exercise. I wonder what protocol one might employ to get a fair toss from a three sided coin that is 'best effort', where the edge is either under or over represented in the outcome but happens 1/4 < p < 1/2


I think the two-sided protocol just extends to three. Do a set of three flips. If any two are the same, restart, until you get three distinct results. Each possible ordering of the three results is equally probable regardless of the weightings, so you can take any designated one (say the first) as the ultimate result.

This should extend to any N, do sets of N flips until you get exactly one of each N distinct result, and take the first as the final result.


Alternately, a protocol for getting a fair "d3" from a coin with any number of sides - flip three times. If all three results are the same or if all three are different, restart. If two are the same and one is different, the position of the odd one out gives your ultimate result.

For example it works for simulating a d3 using a two-sided coin: THH or HTT -> 1, HTH or THT -> 2, HHT or TTH -> 3, HHH or TTT -> reroll.

This can be combined with your protocol, but it takes some thought to interpret because in your protocol the result is what actually shows up on the coin, but in mine it's the position.


Aha, very nice. This is generalizable too: to get a fair dN from a randomization source with any number of unfair outcomes, do sets of N randomizations until you get a set that's exactly 1 of something and N-1 of something else, and the position of the unique one gives the ultimate result. (This requires N > 2, since for N=2 you can't tell which was the 1-of and which was the N-1.)


And you can calculate given an actual fair N-sided dice the proportion of wasted flips/rolls:

1: 0

2: 1/2

3: 7/9

4: 58/64

N: 1 - (N-1)! / N^(N-1)

By the time you have a typical 6-sided dice, you only get 6 different rolls in 6 rolls 1.54% of the time.

I haven't calculated what happens when bias is introduced but my intuition is that with more bias you would discard more. (Based on the extreme case that if one of the sides can never roll you would never accept a result.)


TFA immediately clarifies the title.


Standard coins only have two sides with significant probability of landing such that that side is facing up.


Only if the edge counts, otherwise we need more dimensions like all good theoretical mathematics.


No, if a disc with a thickness of zero is still considered a coin.


Modified question: Are all coins that are possible in this universe 3 sided coins?

A: No at an microscopic/atomic/quantum level there are trillions of sides


I asked the same question 14 years ago so I coded up a quick simulation and empirically discovered that the answer was thickness = 1.33 radius: https://www.youtube.com/watch?v=WFG1OP5OmAw


Which is quite different from the ~1.7r this article arrives at. Is it because your coins are soft? (according to another comment h=thickness/2)


Anyone can make sense of the question? I don't think a thick coin, or a cuboid shaped rolling dice has probabilities for each of its sides to land on. I think that would depend on how we toss it.


The question is: If you model a coin toss, where does the randomness stem from? In a computational model without artificial randomness, you should get perfectly repeatable results, no?


I think it's more about chaos: a deterministic system where the outcome is extremely sensitive to the initial conditions. Actual coin tosses function reasonably well as random variables because most humans cannot control or measure the initial conditions of the toss well enough to determine the outcome before observing it.

A computer model using a deterministic physics system would be completely aware of the initial conditions of each toss. You'd presumably want to introduce some randomness in those initial conditions (using e.g. a pseudorandom number generator) to simulate human coin tosses.


Different initial conditions. Presumably the initial velocity and angular momentum are randomized.


It doesn't model a coin toss, but a coin landing. It's written in the article. Afaik a complete coin toss is very hard if not impossible (?) to model.


If you are God and you make a universe that contains a people that you also created and they flip coins, where does the randomness come from?


there are different takes on the nature and extent of divine determinism. my theology says god created a system (vs. a sequence of events) and intervenes regularly but not always. part of what god created is natural agency, after all, and in this light "everything that happens is meant to happen" is not synonymous with "everything that happens is distinctly willed by god". my understanding is that god is committed to that agency with such intensity that his position (seeing, knowing, and feeling all) compels him to feel sorrow when he knows both that he can end all suffering and that it wouldn't be fair to. accordingly, he likely doesn't see much value in directly controlling most coin flips


From a cryptographically strong PRNG never reseeded that I would use in every kind of calculation, wharever proximity in any property. That will keep anybody trying to understand things on their toes.

(Note: make sure to give them toes.)


Perhaps those coinflips would not be random from the perspective of an all-knowing all-calculating god, similar to knowing the seed of an RNG algorithm and getting the same value each time when you rerun the program.


Quantum effects, of course!


Yes, if there isn't randomness, it'll be deterministic.


The answer is the thickness should be just over half the coin's diameter.

At least according to Twitter and one of the responses to the first "answered before" source linked in the article: https://twitter.com/radu_nicolau/status/956926727971852290


FYI I'm getting FPS issues on Firefox after the simulation runs for 30-60 seconds, but this doesn't happen on Safari.

Coincidentally I recently had a similar issue on a personal project using HTML Canvas that resolved when I discovered I was inadvertently using `ctx.rect(...); ctx.fill(...);` instead of `ctx.fillRect(...)`.

Not familiar enough with Matter.js to know how relevant that might be!


If curved sides are considered sides, wouldn't a symmetric object made from three curved lenticular faces be a more reasonable choice?


For the purposes of building a fair random number generator, obviously so. Especially if you include having everyone using the device also understand and agree that it is fair.

However, the question here is simply directly the question "How thick does a coin have to be to equal chances of landing on its side or either face?", in which case changing the design to something else is simply to answer a different question. At best you might try to extract something useful from the alternate formulation to bring back to your original question, but in this case I wouldn't see any value; we already know that we can construct n-sided symmetric objects from curved faces for n >= 1 (if you consider a sphere a 1 sided die) and it doesn't help the original question much.


You know, I've always disliked d4s and the special way you have to "roll" them for a fair result. Too much technique. A successful roll you can see and even make rules about, as in craps (must hit the back edge of the rolling surface to be fair). I've never had luck finding what I want (which is just a d8 with two surfaces marked with each number 1-4).

I feel the same about some weird d3 shape too, because it doesn't really roll and would require a similar "toss" that's hard to judge. I'd rather have double-marked d6s, which do seem to be available.


So what do you do in practice? Just use a d8 and reduce mod 4?


Oh no, in practice I just do the usual thing and feel vaguely dissatisfied. It just doesn't rise to the level of resisting peer pressure.


Ever since Matt Parker released his original video, I've wondered how I might use a 3D physics engine to run a simulation to find the answer. I thought perhaps it might be a good excuse to learn how to do physical based simulations in Blender but of course I haven't yet got around to it.


Medieval scholars pontificated about how many angels could fit on the head of a pin and we get this.


The battle between the "odds" and the "evens" was particularly fierce.


How easy it is to reinvent a D3?

The problem with a three sided coin is that it will roll away before you can read it. ;) Increasing friction of the coin so that does not happen is left as an exercise for the reader.


A triangular prism shaped with rounded ends is a pretty simple to make, so is a D6 that repeats each side twice.


Take sphere. Divide the surface into N equal parts. Roughen the surface so it stops quickly after rolling.


for all times, the design should allow, over time randomness to be 1/3 pr side?


Why not just use a normal die, mod 3?

Alternatively, imagine a football shape forced into a triangular cross section.


to;dr: how thick is a fair three sided coin?




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: