Random mating prevents change in allele frequency (as described in Hardy Weinberg law) in a population when other evolutionary forces are not acting; though that does not happen in nature.
How does selection affect allele frequencies?
Natural selection also affects allele frequency. If an allele confers a phenotype that enables an individual to better survive or have more offspring, the frequency of that allele will increase.
Does selective breeding change allele frequencies?
Unlike genetic drift, selection has a systematic and directional force on the change in allele frequencies. The frequency of the favourable allele increases at the expense of the less favourable allele. Consequently, more animals will become homozygous for the favourable allele and genetic diversity decreases.