This is using the same phash2 randomization as the original implementation, but I wonder if this is really required. I think can just base it on os:timestamp and modulo (but this is a potential optimization for later). Not using phash2 would be a bit faster, but also a bit less randomized.