fixed inefficient use of 'sort' when textures are to be randomly chosen