The duplications happen because you are mixing pagination with random ordering. (It includes a warning in your screenshot that it can lead to the same items appearing in multiple pages.)
With pagination the database is queried for the first 12 results, and after paginating, the next 12 results, and again after paginating the next 12 results.
If the results are in a fixed order (e.g. ordered alphabetically) then it is predictable and consistent what the second page of results will contain (results 13-24).
But when the ordering is random every request for results is random, so logically the same results can appear multiple times. It is more obvious in your case, using infinite scroll, because the previous results still appear on the page.
If you want to continue with infinite scroll pagination and with random ordering, you could make the page size much larger (e.g. 24 or even 48 results), and then the problem would be less apparent.