randomize array algorithm courtesy