It depends on the generation, but I believe it is calculated like this.

First you have a 3/4 chance of not getting paralyzed. Then you have 1/2 chance of getting through infatuation. After that you need to not hurt yourself in confusion

which is a 2/3 chance.

The probability of you passing through all of those is:

(3/4) x (1/2) x (2/3) = 1/4

So there is a 1/4 chance of you being able to attack. 25%.

After that we calculate the flinch.

(9/10) x (9/10) x (9/10) x (9/10) x (9/10) = 59/100 (0.59049)

41% chance of flinch

Then we need to calculate the probability of you first passing through paralysis, infatuation, confusion and also not get flinched which is 0.25 x 0.59049 = 0.1476225

or 14.76225%

If you're in this situation just switch out.