added randomize check for image gallery