function to generate random number was implemented