A Pseudo Random Distribution
refers to the Warcraft III engine's dynamic probability calculations for certain percentage-based attack modifiers. Rather than using a static percentage, the probability is first set to a small initial value, then gradually increased with each consecutive attack for which the modifier does not occur. The probability then drops back to the initial value when the attack modifier does apply. Not only does this system make long strings of successful modifiers unlikely, but it also makes going an entire game without an attack modifier occurring impossible, as eventually the dynamic probability exceeds 100% and "forces" a modifier on the next attack. The distribution of attack modifiers is therefore not truly random, hence the term Pseudo Random Distribution
. In general, all abilities that are rounded to the nearest 5% in the Warcraft III engine follow this probability distribution.
Pseudo Random Abilities
The list of all currently known base abilities that follow this system of balanced randomness is shown below. Triggered abilities notably do not
fall in this list.
- Critical Strike (ex. Phantom Assassin’s Coup de Grace, Crystalys)
- Bash (ex. Faceless Void’s Time Lock. As of its remake, Cranium Basher does not follow this distribution.)
- Pulverize (ex. Infernal’s Flaming Fists, Tidehunter’s Anchor Smash)
- Orb of Slow (ex. Maim, Maelstrom)
- Hardened Skin (ex. Stout Shield, Vanguard)
Probability MechanicsCritical Strike Example
Consider the case of a 20% chance to Critical Strike. If the game were truly random, then for each attack there would be a 20% chance for the unit to land a Critical Strike, regardless of how many Critical Strikes had been performed in the past. A simple implementation would therefore be to select a random integer between 1 and 100, and if the integer was less than or equal to 20, then the engine would cause that attack to be a Critical (which is the usual construct used by triggered percentage-based abilities). While this implementation would, in the long run, average out to 20% of attacks being Criticals, there is nothing preventing an infinite series of Critical Strikes or, conversely, an absence of Critical Strikes for the entire game, although the chance is rather insignificant. To prevent the ensuing complaints and balance this random game mechanic, the Warcraft III developers implemented a Pseudo Random Probability Distribution
Instead of there being a 20% chance to Critical Strike with every attack, the first attack made actually has a 5.57% chance to Critical Strike. If that is not a Critical Strike, then the second attack has a 11.14% chance to Critical. If that is also not a Critical Strike, then the third has a 16.71% chance to Critical, and so on, adding 5.57% for each consecutive non-Critical. When a Critical Strike does occur, however, the chance for the next attack resets to 5.57%. In the long run, the number of Critical Strikes divided by the total number of attacks somewhat approximates the stated 20%, but now it is extremely difficult to have a series of Critical Strikes, and also impossible to go more than 17 attacks without a Critical, because the percentage for the 18th attack (assuming 17 previous consecutive non-Critical attacks) is 100.26%. In effect, the game causes the number of attacks between Criticals to be skewed towards 1 / 20% = 5, with a maximum limit of 17.
The following sections deal with specific mechanics of the PRD. It is very long, and probably very boring too, unless you enjoy math and/or coding. For everyone else, feel free to skip down to the Summary section at the end.
For all of the abilities stated above, the Warcraft III engine uses an initial percentage (%) value that linearly increases with each consecutive attack for which the attack modifier does not apply. The probability formula for an attack modifier to occur is therefore:
In this formula, P(N) is the % probability for the modifier to occur on the Nth attack, N is the number of attacks since the last attack modifier (minimum value of 1), and C is a constant that serves as both the initial % and the increase in % with each attack. Since this is a linear formula, when N reaches a high enough value, P(N) will exceed 1 and the next attack is guaranteed to have an attack modifier. Simple algebra shows this N value to be equal to 1 / C
. The value of C in turn depends on the probability stated in the World Editor for that skill; for the rest of this article, this stated probability will be referred to as P(E), the expected probability.
Pseudo Random Probability Constants
Two tables of C values are shown below. P(E)
is the expected probability, C
is the constant, and the maximum number of consecutive attacks that can occur without the attack modifier is listed under Max N
. So for a Critical Strike with a value of 45%, a series of four normal attacks can occur, but the fifth attack will then have to be a Critical. This first table represents the theoretical C values for every multiple of 5%, which were calculated using numerical methods (credits to ICallBotSolo and Cano Tolto).
Theoretical Probability Constants
These theoretical probability constants do not match the ones that Blizzard employs, however, with serious consequences that will soon be made clear. This next table lists the C values that the WC3 engine appears to use, along with the corresponding actual probability. These values were estimated from experiments involving upwards of a million attacks.
Actual Probability Constants
The table below has a side by side comparison of theoretical and actual values:
Compiled Probability Constants
As the tables show, the actual and theoretical C values agree closely up to 30%, but then diverge sharply. In other words, the actual probability of attack modifiers is significantly lower than the expected probability as P(E) increases, a mistake that Blizzard has yet to correct.
For obvious reasons, the overall probability of the attack modifier occurring should be as close as possible to P(E). In other words, after an infinite series of attacks, the number of attack modifiers that occurred divided by the total number of attacks should ideally be equal to P(E). However, Warcraft III's Pseudo Random Distribution
actually results in an overall probability that is less than P(E). While this negative deviation is insignificant at low P(E), differing by less than a percent for P(E) = 30%, the error increases sharply for higher percentages: a P(E) of 80% actually has a probability of only ~66.7%. This error likely results from two factors:
1. A truncation in C. Without an infinite number of digits available for C, it is virtually impossible for a linear probability formula to accurately model a random distribution for a given P(E). Simply calculating C requires a significant amount of computing time, considering that it has to match an entire probability distribution to a single constant. This is the reason why all of the above skills are rounded to the nearest 5%: instead of dynamically calculating C as well, which would take up far too many CPU resources for each attack, the developers were able to create a static table of C values for 5%, 10%, 15%, ...95%, which could then be substituted into the above formula to determine P(N). The truncation of these defined values, which always results in smaller values, then leads to actual probabilities that are less than P(E). This effect should be nearly negligible for high C values, however, meaning that this cannot account for the significant errors seen at high P(E).
2. Ladder P(E) values. Blizzard tailored Warcraft for Ladder play, not custom maps, and the highest P(E) in Ladder is the Tauren's Pulverize, with a probability of 25%. It is likely not a coincidence that the error in P(E) increases significantly after this point. When Blizzard implemented the PRD, they probably only calculated C values for the percentages that they knew they'd use in Ladder, and all other values were simply estimated from those results (e.g. with a fitted exponential curve). Apparently they didn't care to check whether those values actually worked, leading to the current situation.
To make the difference between the PRD and true random distributions even more clear, consider one of the above abilities with P(E) = 10%. The following graph shows the probability of getting an attack modifier on the Nth attack since the last modifier occurred, if the distribution were truly random. It is important to note that while the probability of getting an attack modifier for each individual attack is always 10% in a true random distribution, simply getting to the Nth attack without an attack modifier has only a (1 - P(E))^(N - 1)
chance. So for N = 2, the probability is 0.09: 90% chance that the first (N = 1) attack was not an attack modifier, multiplied by the chance of getting a critical for the N = 2 attack (10% for all attacks in a true random mechanism).
Note that the distribution follows a simple exponential formula, with a probability that steadily decreases by 0.1 with each consecutive attack.
Now compare that graph with this Pseudo Random Distribution. This graph shows the same probability of getting an attack modifier on the Nth attack since the last modifier occurred, but with Warcraft III's Pseudo Random Distribution
. Again, it is important to note that this graph does not show the individual probability of getting an attack modifier on the Nth attack (which is given by P(N) = C * N
), but the product of P(N) and the chance that none of the previous N - 1
attacks have had a successful attack modifier.
Note that the chance for the first attack is equal to the value of C for P(E) = 10%: 0.01475. The differences should be clear: there is a much lower chance of getting consecutive attack modifiers, the overall distribution is shifted to the right, and there is also a finite point at which the probability reaches 0, although not quite shown on this graph.
Practical ImplicationsAttack Counter
The attack counter N is integral to the PRD, but its mechanics are not fully understood. Much of the following is inferred from observation and common sense, simply because we have no way of knowing exactly how Blizzard implemented the PRD. The counter does not increase when attacking units against whom the attack modifier cannot apply. So attacking an enemy building would not increase the chance of a Critical Strike or Bash on the first subsequent attack(s) on an enemy unit. The counter also does not increase when the hero misses an attack due to Evasion, height difference, or debuffs such as Drunken Haze. Attacks “evaded” through Triggered Heals
will still apply to the counter, however.
For Orb of Slow-based abilities, the counter is not disabled during the cooldown period. This means that attacks made by the Spirit Bear
during the cooldown of Entangle will greatly increase the chance of entangling as soon as the cooldown is over.
Each pseudo random skill has its own attack counter, even if multiple skills of the same type are on the same hero. If multiple pseudo random skills proc at the same time but one overrides, both counters are reset nonetheless, e.g. in the case of two Critical Strikes. On a similar note, Illusions have their own attack counters for skills they inherit from the parent hero.
The Pseudo Random Distribution
permeates all of gameplay, with some direct applications as well. A hero with a Critical Strike ability could fight creeps until a long string of non-Criticals occurred, then head into a team battle with an increased Critical Strike chance for his first attack(s). Such a tactic, while time consuming, could significantly increase the hero's DPS for that battle. The applications are even greater for heroes with an innate Bash skill, who could build up the same string of non-Bashes in order to maximize their chances of landing a Bash in the beginning of battle (remember that Cranium Basher does not follow the PRD). Furthermore, the fact that consecutive Bashes are discouraged by the Pseudo Random Distribution
benefits Bash heroes greatly in that stun times will not overlap as much as in a true random distribution, making Permabashing a distinct possibility. Stacking attack speed items may therefore be feasible on these heroes, and especially for Syllabear’s Spirit Bear for the reason stated above.
The PRD is a built-in feature of the Warcraft III engine that balances many chance-based abilities to prevent too many or too few activations. Because of this system, players are guaranteed an attack modifier (ex. Critical Strike, Damage Block, Bash, etc) after a certain number of attacks. Every time an attack occurs (that is against a valid target and does not Miss) and the modifier does not activate, the chance of the modifier activating in the future increases linearly; when the modifier does proc, however, the chance drops back to a low initial value. As a result, attack modifiers tend to occur non-consecutively and at more regular intervals. Due to a programming oversight by Blizzard, at percentages greater than 30%, attack modifiers regulated by the PRD activate less frequently than they should. The PRD does not affect Evasion or triggered skills such as Multicast and Starfall.
Forum Topics 219284
. In these forum topics, a slightly different formula is used in which N is defined as the number of in-between attacks, which has a minimum value of 0. For ease of comprehension, this article defines N as the number of attacks since the last attack modifier, with a minimum value of 1.
This article was originally written for the Dota-Allstars Wiki in October 2008. This subject was first researched in May 2008, but the person who said he'd write a guide about it never got around to it. So after realizing there still wasn't any consolidated guide or article about this fairly hefty game mechanic, I compiled all the information from the two forum topics and wrote this guide. I do not claim any of the findings as my own, nor do I take any credit for the testmaps, formulas, or findings from Malle, ICallBotSolo, 1239, and many others who contributed. The additions from Cano Tolto, Clogon, and 3DM@rk were invaluable in updating this article, as was the testmap from KileRatZ which was instrumental in estimating the actual probabilities and constants. Thanks to Wyvernoid for editing the first versions.
Feedback, and especially corrections, would be greatly appreciated.