code for copy random list