in the hyperloglog algorithm, a hash function is applied to each element in the original multiset to obtain a multiset of uniformly distributed random numbers with the same cardinality as the original multiset. the cardinality of this randomly distributed set can then be estimated using the algorithm above.