Initially I thought that the number of bits of the hash and the new feature space dimension would be two different parameters.
However, if num_bits = log2(dim), I feel that line 108 above is redundant, since we reduce the dimension in the mod operation..