distribution of frequency using frequency function