PDA

View Full Version : Half-life roll?



JusticeZero
2022-10-07, 11:01 PM
Looking at a subsystem, but for it, I would want to be able to do a random time roll for something of indeterminate length, basically a half-life. Could happen in ten seconds, could happen in a month or five, on average it happens every X hours.
Does anyone know a way to roll something that curvy and open ended?

Bohandas
2022-10-08, 12:04 AM
You could do repeated rolls or coin tosses until a specific value is rolled

JusticeZero
2022-10-08, 12:17 AM
I'm not sure I understand what you mean?
The half-life decay experiment with dice is repeated tests of "Did it decay yet? Did it decay yet?"
I want "(Event) is going to happen in (rolls once with something like explosive/implosive dice) four days, at two in the morning."

Yora
2022-10-08, 07:48 AM
Just roll 1d6 every hour. Or any dice you want, at any interval you want.

Previous rolls do not influence the odds for future rolls. Just like with nuclear decay.

Bohandas
2022-10-08, 10:03 AM
I'm not sure I understand what you mean?
The half-life decay experiment with dice is repeated tests of "Did it decay yet? Did it decay yet?"
I want "(Event) is going to happen in (rolls once with something like explosive/implosive dice) four days, at two in the morning."

Well then you'd just roll all the "did it decay yet" dice before hand instead of at the time

mucat
2022-10-09, 01:52 PM
I'm not sure I understand what you mean?
The half-life decay experiment with dice is repeated tests of "Did it decay yet? Did it decay yet?"
I want "(Event) is going to happen in (rolls once with something like explosive/implosive dice) four days, at two in the morning."
The easiest way is just to roll the "did it decay yet" dice in advance. Roll a bunch of dice, read them in order from left to right, and stop the first time you get the "yes it decayed" result. (And if each die represents, for example, one day, you're not sacrificing much accuracy if you then roll randomly for "what time on day 5 does it decay?")

But if you want a snazzier, mathematically precise way: roll d10s to produce a number between .0001 and 1.0000 (using as many d10s as you want decimal places of precision.) Then take the natural log of the number. It will be negative; flip it to positive. This is how many time units it will take before the decay.

Your half-life is a little under one (precisely, ln(2) = 0.693) of these time units. So set the time unit to whatever fits the situation. (If instead of taking the natural log, you take the log base 2, your half life will be exactly one time unit.)

meschlum
2022-10-09, 04:10 PM
Well, exploding dice and half lives make it easy. Just use a d8.

1-4: one half life
5-6: two half-lives
7: three half lives
8: die explodes, reroll and add three half lives.

So if you rolled an 8 and then a 6, you'd have 3 + 2 = 5 half lives. If you rolled 8, 8, 1, you'd have 3 + 3 + 1 = 7 half lives


If you want finer temporal resolution (so a roll of 1 or 2 give you different results), use a log table, per mucat. You're still going to have only a few different values, but that's more or less inevitable: if you roll a single d8, you can only get 8 different values! So it's a tradeoff between rolling more dice and getting finer precision - if you roll a dozen d10s each time, you'll have a lot of precision involved. If you roll a single die at most, you'll have a lot less.


Math! Going into a bit more detail on mucat's baseline

Generate a random number R uniformly between 0 and 1. If using a dX, you can use 1dX / (X+1), for instance. Ideally, you want this to be excruciatingly precise.

log2(1/2) = -1 (one half life)
log2(1/4) = -2 (two half lives)
...

So you just take - log2(R) and get the number of half lives. Since you're highly precise, this gets you different numbers of half lives with each roll, rather than the basic exploding d8 method above.


You can actually combine the two methods, so a roll of 1 or 2 on a d8 does not give the same number of half lives, but your precision will still be limited.

Roll 4: 1 half life exactly (4/8 = 0.5)
Roll 6: 2 half lives exactly (6/8 = 0.75)
Roll 7: 3 half lives exactly (7/8 = 0.875)

So you want to fill in half lives for rolls of 1, 2, 3, and 5 in a consistent way

1: -log2(1 - 1/8) ~ 0.19 half lives
2: -log2(1 - 2/8) ~ 0.415 half lives
3: -log2(1 - 3/8) ~ 0.68 half lives
4: -log2(1 - 4/8) = 1 half life
5: -log2(1 - 5/8) ~ 1.415 half lives
6: -log2(1 - 6/8) = 2 half lives
7: -log2(1 - 7/8) = 3 half lives

And if you roll an 8, it explodes, so you roll the d8 again in the table above and add 3.

Note that the values for rolls of 2 and 5 are exactly 1 apart, because 6/8 is twice 3/8, so it's an extra half life.

You can create a similar table with other exploding dice (e.g. d20), but the number of half lives you add on an explosion usually won't be as nice (it's ~4.322 with a d20).

This gives a limited range of half life values, but is faster to roll than a dozen d10s in order.