https://docs.google.com/spreadsheet/ccc?key=0AolmfMZIKKb4dGNqTFhzSmlXanFXS3hsNVYwbjlOeXc&usp=sharingThere's probably a more elegant way of doing this but at least this way it's demonstrative.
The top starts by treating the probability of a single round of stealth. The big box shows the possible 400 outcomes of rolling two d20s; in the example that I've saved, the Detector has +0, and the Stealther has +15 (as the Stealther's roll sets the DC for the Detector's check, that means ties go to the Detector).
As you can see, the top right triangle of 1s in the big box shows those cases where the Detector wins. There's 15 boxes out of 400, so the probability that the Stealther is seen is 15/400, or 3.75%. Conversely, the probability that the Steather isn't seen is 96.25%.
But of course that doesn't tell you how long you're going to stay stealthed. Unless you beat the Detector by 20, you're going to be spotted eventually: as long as your success % is less than 100, you're going to get unlucky at some point.
The probability that you stay stealthed for 2 rounds in the above example is 96.25%
2; the probability of staying stealthed for 3 rounds is 96.25%
3. In general, the probability of staying stealthed for t rounds is S
t, where S is the probability of staying stealthed for one round. So if we look at the case on the "edge of the coin" to figure out the average time, we're trying to find:
S
t = 0.5
=> t ln(S) = ln(0.5) (natural logarithms)
=> t = ln(0.5)/ln(S)
So to put back in the numbers, if my Stealth score beats your Detector score by 15, I can anticipate that I will stay hidden or an average of 18.13 rounds, or about 108 seconds.
The final table for this I put at the bottom of the sheet.
What's really striking about this table is that it illustrates just how critical just a few points of stealth can be for a Stealther. If I beat your Detector score by 19, I can anticipate my stealth will last ~276 rounds and pocket change, which is about half an hour. Knock me down three points to +16, and my average stealth time is drastically reduced to 27 rounds and change, which is less than three minutes. Knock me down another three points to +13 and my average stealth time will last barely a minute.
N.B.: This feels intuitively correct but it's been a long time since I did proper statistics so I can't be completely certain I'm correct :p
One thing I haven't done is explored the variance, which tells you how reliable the average score is; but I think even I'm growing bored of this atm