What is the probability that the number of zeros of a binary sequence with length $m$ is at least $q$? For a practical problem for a project (not educational) for a friend I need your help.


*

*We have a sequence $b$ of $m$ binary values: $$b_1,...,b_m $$ Update: We have sequence b'of m' hexadecimal ($b_i$=0,1,...15) values: $$b_1,...b'_m$$

*$n<m$ of them have value 1, the other $m-n$ elements have value 0    
$n'<m'$ of them don't have value 0 (but 1-15), the other $(m'-n')$ elements have value 0

*We choose $x<m$ elements and randomly change their values (independenty). So if $b_j$ is one of those $x$ elements, then the probability that its value is 0 is $1/2$ and the probability that its value if 1 is $1/2$ after modifying.
We choose $x'<m'$ elements and randomly change their values (independenty). So if $b_j$ is one of those $x'$ elements, the probability that its value  is 0 is $1/16$ and the probability that its value is not 0 is $15/16$ after modifying.

*After that I want to know what the probability is for having at least $q<m$ zeros in the modified elements.
After that I want to know what the probability is for having at least $q'<m'$ zeros in the modified elements.
I need a method to calculate this probability $P(m,n,x,q)$.
I need a method to calculate this probability $P'(m',n',x',q')$.


*

*$m > 1000$

*$0<n<0.3m$

*$0<x<0.6m$

*$0.5m <q < m$


Any idea? Thanks a lot !
In addition: if a mathematical approach is not available, I will also accept any answer that contains a complete java or matlab code where I just can plug in $m,n,x$ and $q$ with output $P$.
 A: If if doesn't have to be exact, the normal approximation will be easy to use.  If an individual bit is chosen to be flipped, it has $\frac nm$ chance of starting as a $1$ and $\frac {m-n}m$ chance of starting as a $0$.  It has $\frac n{2m}$ chance of changing from $1$ to $0, \frac {m-n}{2m}$ chance of changing from $0$ to $1$ and $\frac 12$ chance of not changing.  Your expected number of $1$'s after flipping is then $\mu=n+x(\frac{m-n}{2m}-\frac n{2m})=n+x\frac{m-2n}{2m}.$  The variance on the change of a single bit is $\frac 12$, so the standard deviation of the number of $1$ bits after flipping is $\sigma=\sqrt {x}/2$  Compare your $q$ to $\mu$ to see how many standard deviations different they are.  You can then look up the probability of being that far away in a standard normal or z-score table.  Your programming language may well have a function for this.  
Added for the hex problem:  the same approach works.  First compute the expected number of zeros after the perturbation.  You start with $n'$ zeros, on average $n'(1-\frac x{m'})$ will not be modified and $\frac x{16}$ of the modified digits will become zero, so $\mu=n'(1-\frac x{m'})+\frac x{16}$.  The average change of the number of zeros in one altered digit is $\frac 1{16}-\frac {n'}{m'}$ The variance on the change of a single bit is $\frac 1{16}\cdot \frac {15}{16}=\frac {15}{256}$.  The standard deviation is then $\sigma=\frac {15x'}4$
