building custom function to generate random task