factor out counting of uniques after N random runs