I was wondering what the best way to convert a text string into a int (which will be used as a seed)
I know GetHashCode() does this, but, at least according to this page, GetHashCode() is very unreliable in the fact that the value it creates may not be the same every time it is generated:
The hash code itself is not guaranteed to be stable. Hash codes for identical strings can differ across versions of the .NET Framework and across platforms (such as 32-bit and 64-bit) for a single version of the .NET Framework. In some cases, they can even differ by application domain.
Since this is used to generate a seed, I want it to always have the same number when, for example, the string is “Hello World”. I want the number to be the same every time it is done, the same number on everyone’s computer, always.
I’m unsure whether Unity’s GetHashCode() will have the results I’m looking for or not. If you have more information on GetHashCode() that can help, I’ll gladly take it.
If GetHashCode() won’t work for what I want, I want to find a way to “numerize” a string of text into a number that is not too large for a regular 32-bit int. If anyone knows a method of doing so, I’ll attempt to implement it.
Thank you!