Binomial Behavior in Security Breach Simulations
In this simulation, we study a server that receives weekly security updates for n weeks.
Each week, m independent attackers attempt to breach the system, and each attacker has a probability p of succeeding.
The probability that the server is breached during a given week is:
q = 1 − (1 − p)^m
Each week, we assign:
- +1 if the server remains secure
- −1 if it is breached
The cumulative score over time behaves like a random walk, where each step represents one week’s security outcome.
After n weeks, the total score S is given by:
S = 2k − n
where k is the number of secure weeks.
Since k follows a Binomial distribution Bin(n, 1−q), the total score S follows the same distribution scaled to the range [−n, n].
The simulation below generates random trajectories of this cumulative score for many servers and compares the empirical distribution of final scores with the theoretical binomial distribution. As n and m grow, the simulated results converge to the theoretical curve.