Merge pull request #58028 from Calinou/doc-array-hash
Clarify identical `hash()` return values due to collisions
This commit is contained in:
commit
48ed0400bc
4 changed files with 8 additions and 5 deletions
|
@ -299,8 +299,8 @@
|
||||||
<method name="hash" qualifiers="const">
|
<method name="hash" qualifiers="const">
|
||||||
<return type="int" />
|
<return type="int" />
|
||||||
<description>
|
<description>
|
||||||
Returns a hashed integer value representing the array and its contents.
|
Returns a hashed 32-bit integer value representing the array and its contents.
|
||||||
[b]Note:[/b] Arrays with equal contents can still produce different hashes. Only the exact same arrays will produce the same hashed integer value.
|
[b]Note:[/b] [Array]s with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does [i]not[/i] imply the arrays are equal, because different arrays can have identical hash values due to hash collisions.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="insert">
|
<method name="insert">
|
||||||
|
|
|
@ -98,7 +98,8 @@
|
||||||
<method name="hash" qualifiers="const">
|
<method name="hash" qualifiers="const">
|
||||||
<return type="int" />
|
<return type="int" />
|
||||||
<description>
|
<description>
|
||||||
Returns the hash value of this [Callable]'s object.
|
Returns the 32-bit hash value of this [Callable]'s object.
|
||||||
|
[b]Note:[/b] [Callable]s with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does [i]not[/i] imply the callables are equal, because different callables can have identical hash values due to hash collisions. The engine uses a 32-bit hash algorithm for [method hash].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="is_custom" qualifiers="const">
|
<method name="is_custom" qualifiers="const">
|
||||||
|
|
|
@ -259,7 +259,7 @@
|
||||||
<method name="hash" qualifiers="const">
|
<method name="hash" qualifiers="const">
|
||||||
<return type="int" />
|
<return type="int" />
|
||||||
<description>
|
<description>
|
||||||
Returns a hashed integer value representing the dictionary contents. This can be used to compare dictionaries by value:
|
Returns a hashed 32-bit integer value representing the dictionary contents. This can be used to compare dictionaries by value:
|
||||||
[codeblocks]
|
[codeblocks]
|
||||||
[gdscript]
|
[gdscript]
|
||||||
var dict1 = {0: 10}
|
var dict1 = {0: 10}
|
||||||
|
@ -276,6 +276,7 @@
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/codeblocks]
|
||||||
[b]Note:[/b] Dictionaries with the same keys/values but in a different order will have a different hash.
|
[b]Note:[/b] Dictionaries with the same keys/values but in a different order will have a different hash.
|
||||||
|
[b]Note:[/b] Dictionaries with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does [i]not[/i] imply the dictionaries are equal, because different dictionaries can have identical hash values due to hash collisions.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="is_empty" qualifiers="const">
|
<method name="is_empty" qualifiers="const">
|
||||||
|
|
|
@ -241,7 +241,8 @@
|
||||||
<method name="hash" qualifiers="const">
|
<method name="hash" qualifiers="const">
|
||||||
<return type="int" />
|
<return type="int" />
|
||||||
<description>
|
<description>
|
||||||
Hashes the string and returns a 32-bit integer.
|
Returns the 32-bit hash value representing the string's contents.
|
||||||
|
[b]Note:[/b] [String]s with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does [i]not[/i] imply the strings are equal, because different strings can have identical hash values due to hash collisions.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="hex_to_int" qualifiers="const">
|
<method name="hex_to_int" qualifiers="const">
|
||||||
|
|
Loading…
Reference in a new issue