A bound on the number of generators of a finite group