I have a function that generates a random integer and appends in list till the number is generated again and if it matches with the number in the list than the list is retur