# Is this expected \`hash\`ing behaviour?\`\`\`julia&gt; a = \[rand(0:1, 200) for i in 1:

**URL:** https://discourse.julialang.org/t/is-this-expected-hash-ing-behaviour-julia-gt-a-rand-0-1-200-for-i-in-1/55510
**Category:** General Usage
**Created:** [February 18, 2021, 6:35am UTC](https://discourse.julialang.org/t/is-this-expected-hash-ing-behaviour-julia-gt-a-rand-0-1-200-for-i-in-1/55510 "2021-02-18T06:35:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)
#### Post date: [February 18, 2021, 6:35am UTC](https://discourse.julialang.org/t/is-this-expected-hash-ing-behaviour-julia-gt-a-rand-0-1-200-for-i-in-1/55510/1 "2021-02-18T06:35:33Z")

</div>

Is this expected `hash`ing behaviour?

```julia
julia&gt; a = [rand(0:1, 200) for i in 1:10000]
julia&gt; b = deepcopy(a)
julia&gt; a[1][1] = 2
julia&gt; hash(a) == hash(b)
true

```

It seems to be different with smaller vectors:

```julia
julia&gt; a = [rand(0:1, 200) for i in 1:10]
julia&gt; b = deepcopy(a)
julia&gt; a[1][1] = 2
julia&gt; hash(a) == hash(b)
false

```

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1613630107138800?thread_ts=1613630107.138800&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

### Author: ![mmiller](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmiller/32/20805_2.png) [@mmiller](https://discourse.julialang.org/u/mmiller)
#### Post date: [February 21, 2021, 4:38am UTC](https://discourse.julialang.org/t/is-this-expected-hash-ing-behaviour-julia-gt-a-rand-0-1-200-for-i-in-1/55510/2 "2021-02-21T04:38:35Z")

</div>

From Slack:

From the `hash(A::AbstractArray, h::UInt)` [function](https://github.com/JuliaLang/julia/blob/3129a5bef56bb7216024ae606c02b413b00990e3/base/abstractarray.jl#L2407-L2420):

```julia
    # Goal: Hash approximately log(N) entries with a higher density of hashed elements
    # weighted towards the end and special consideration for repeated values. Colliding
    # hashes will often subsequently be compared by equality -- and equality between arrays

```

This is done as otherwise hashing of arrays would always be `0(n)`.
