use Murmur Hash algorithm to compute permanents id

master
melvin 2011-06-15 12:47:15 +08:00
parent bbd52788d7
commit fc003bef08
1 changed files with 5 additions and 3 deletions

View File

@ -28,10 +28,12 @@ public class MagicPermanentSet extends TreeSet<MagicPermanent> {
}
public long getPermanentsId() {
long id = 0;
int idx = 0;
long[] input = new long[size() + 1];
for (final MagicPermanent permanent : this) {
id = id * 31 + permanent.getPermanentId();
input[idx] = permanent.getPermanentId();
idx++;
}
return id;
return magic.MurmurHash3.hash(input);
}
}