Let X(n) be a random variable enumerating the number of appearances of a specific pattern in a sequence of n Bernoulli trials. A new method is presented for obtaining the conditional distribution of X(n) given the number of successes in the n trials. The method is applied to three fixed-length run statistics and the results are used for establishing and investigating certain non-parametric tests of randomness.