Random distribution

Randomness is sometimes rejected from competitive gaming since it can decide over loss and defeat without reflecting the actual skill level. However, coping with the unexpected is an aspect of skill. Nonetheless there are a couple of random events within Dota 2, that keep the game less predictable and static. To limit the influence of huge streaks, pseudo-random distribution replaces the true random distribution where it made sense for the developers.

Definition


The uniform or true random distribution describes the probability of random event that underlies no manipulation of the chance depending on earlier outcomes. This means that every "roll" operates independently.

The pseudo-random distribution (often shortened to PRD) in Dota 2 refers to a statistical mechanic of how certain probability-based items and abilities work. In this implementation the event's chance increases every time it does not occur, but is lower in the first place as compensation. This results in the effects occurring more consistently.

The probability of an effect to occur (or proc) on the N-th test since the last successful proc is given by $$P(N) = C \cdot N$$. For each instance which could trigger the effect but does not, the PRD augments the probability of the effect happening for the next instance by a constant C. This constant, which is also the initial probability, is lower than the listed probability of the effect it is shadowing. Once the effect occurs, the counter is reset.

Technically, if $$X_i$$ corresponds to the event occurring on trial $$i$$ and $$\neg X_i$$ is the inverse of that event, pseudo-random distribution enforces that $$P(X_N | \neg X_i$$ for all $$i < N) = C \cdot N$$. Also, when $$C \cdot N \geq 1$$, which occurs on the first trial $$N$$ where $$N \geq \frac{1}{C}$$, the event is guaranteed if it has not already happened. This results in a distribution where $$P(X_k) = (1-C) \, (1 - 2 \, C) \, ... \, (1 - (k-1) \, C) \, k \, C = k! \, C \, \prod_{i=1}^{k-1}(\frac{1}{i} - C)$$.

Example

 * On melee heroes, 's Bash has a 25% chance to stun the target. On the first attack, however, it only has an ~8.5% probability to bash. Each subsequent attack without a bash increases the probability by ~8.5%. So on the second attack, the chance is ~17%, on the third it is ~25.5%, etc. After a bash occurs, the probability resets to ~8.5% for the next attack. These probabilities average out so that, over a moderate period of time, Bash effect procs nearly 25% of the time.

Effects based on PRD rarely proc many times in a row, or go a long time without happening. This makes the game less luck based and adds a great deal of consistency to many probability-based abilities in Dota 2. Gameplay wise, PRD is difficult to exploit. It is theoretically possible to increase your chance to bash or critical strike on the next attack by attacking creeps several times without the effect happening, but in practice this is nearly impossible to do. Note that for instances that would not trigger the effect, the probability counter does not increase. So a hero with critical strike attacking buildings does not increase its chance to critical strike on its next attack, since critical strike does not work against buildings. The chance is not reset/increased as long as the ability is on cooldown as well (e.g. Bash).

C Values
The values of C as a function of nominal chance are given below :

Flat distribution
Some mechanics roll a random value between 0 and 1 and scale it along the minimum / maximum gradient. This includes


 * Attack damage of units, if they have a minimum and maximum attack damage range.
 * Last hit gold bounty, if a minimum and maximum range is given.
 * 's respawn timer.

Discrete distribution
A couple of random events have discrete states that have similar probability.
 * Powerup Runes with a discrete clamping over the 6 types and 2 locations.
 * Neutral camps can spawn different creeps for each of the small, medium, hard and ancient camps.

Pseudo random events
Along with the listed abilities, the 25% uphill miss chance and the drop chance of neutral items use pseudo random distribution as well.

Legacy data
The following table shows legacy data cited from the website of the original WC3 DotA. P(T) is the theoretical probability, P(A) is the actual probability. C is the PRD constant. Max N is the minimum number of attacks that would result in $$C \cdot N$$ becoming greater than 1 (i.e. guaranteed proc). Average N is the expected value of N: the sum of the products of N and probabilities. SD is the standard deviation of N, a measure of how spread the data is, using the population formula. The lower the deviation, the more consistent the procs are. For comparison, SDt is the standard deviation of N in true random distribution, using the sample formula from N = 1 to N = 264. These are higher than those of PRD, hence not as consistent.