Added code for Average and Random sequence