hash - Is java's hashCode() deterministic? -


this question has answer here:

is java's hashcode() deterministic?

i try implement document search engine uses minhashing algorithm , use hashcode pre-hash words. same word going same hash every time run it?

is going same hash if run different machine (32 bit vs 64bit)?

it depends on class referring to. base object.hashcode implementation not, since, stated in documentation:

as reasonably practical, hashcode method defined class object return distinct integers distinct objects. (this typically implemented converting internal address of object integer, implementation technique not required javatm programming language.)

addresses not deterministic, consider used source of entropy.

but, instance, string has deterministic hash code determined follows:

formula wikpedia

(image taken wikipedia)

in cases there not sensible deterministic definition hash code.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -