Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34495

Re: Java Source of Meiyan Hash Scrambler?

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Java Source of Meiyan Hash Scrambler?
Date 2016-06-06 08:47 -0400
Organization A noiseless patient Spider
Message-ID <nj3re0$j1o$1@dont-email.me> (permalink)
References <8d97fe56-983e-412d-bf46-73f46c3e1bae@googlegroups.com> <nj3nuq$5i8$1@dont-email.me> <nj3pcj$5nj$1@news.albasani.net>

Show all headers | View raw


On 6/6/2016 8:13 AM, Jan Burse wrote:
> Eric Sosman schrieb:
>>      Hmmm?  Float.hashCode() uses all thirty-two bits of the float,
>> and Double.hashCode() uses all sixty-four bits of the double.  All
>> the bits -- including the exponent bits -- contribute to the hashes.
>
> They contribute to the hash code, i.e. the result of hashCode(). But
> they don't contribute to the hash table index.

     Aha!  Sorry; I thought your problem was with the hashCode() values
themselves.

> But this scramble function is still weak for float32 and float64,
> for my test table I still get, where the hash table length is 4:

     That seems a peculiar size for the hash table.  The default
initial capacity for a HashMap is sixteen, and with the default
load factor of 0.75 the map will grow to sixteen slots by the
time you've inserted eight keys.  The only way I can imagine an
eight-key HashMap with only four buckets is if you specified an
initial capacity of four and a load factor greater than two.

     However, your point stands: Even with a sixteen-bucket table,
the low-order four bits of your small key set will not scramble
very well ...

> So contrary to Oracle/Java claim this scramble function is
> not good for float32 and float64 as they describe.

     Much depends on the values of the keys (as is the case for
all hashing schemes).

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Java Source of Meiyan Hash Scrambler? bursejan@gmail.com - 2016-06-05 17:22 -0700
  Re: Java Source of Meiyan Hash Scrambler? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-06 07:48 -0400
    Re: Java Source of Meiyan Hash Scrambler? Jan Burse <janburse@fastmail.fm> - 2016-06-06 14:13 +0200
      TreeBins Problem and Float/Double (Was: Java Source of Meiyan Hash Scrambler?) Jan Burse <janburse@fastmail.fm> - 2016-06-06 14:45 +0200
      Re: Java Source of Meiyan Hash Scrambler? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-06 08:47 -0400
      Floating-point hash keys (Was: Java Source of Meiyan Hash Scrambler?) Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-06 12:02 -0400
        Re: Floating-point hash keys (Was: Java Source of Meiyan Hash Scrambler?) Roedy Green <inquiry@mindprod.com> - 2016-06-09 05:33 -0700
          Re: Floating-point hash keys (Was: Java Source of Meiyan Hash Scrambler?) Jan Burse <janburse@fastmail.fm> - 2016-06-09 16:27 +0200
  Re: Java Source of Meiyan Hash Scrambler? Roedy Green <inquiry@mindprod.com> - 2016-06-07 03:24 -0700
    Re: Java Source of Meiyan Hash Scrambler? Jan Burse <janburse@fastmail.fm> - 2016-06-07 15:38 +0200
    Re: Java Source of Meiyan Hash Scrambler? Jan Burse <janburse@fastmail.fm> - 2016-06-07 15:39 +0200
      Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Jan Burse <janburse@fastmail.fm> - 2016-06-07 15:42 +0200
        Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Roedy Green <inquiry@mindprod.com> - 2016-06-09 05:29 -0700
          Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Mike Amling <mamling@chaff.us> - 2016-06-09 08:00 -0500
            Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Eric Douglas <e.d.programmer@gmail.com> - 2016-06-09 06:07 -0700
              Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-09 11:41 -0400
              Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Roedy Green <inquiry@mindprod.com> - 2016-06-11 01:17 -0700
                Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Daniel Pitts <usenet@coloraura.com> - 2016-06-11 12:31 -0700
                Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Mike Amling <mamling@chaff.us> - 2016-06-12 15:42 -0500
                Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Daniel Pitts <usenet@coloraura.com> - 2016-06-12 21:03 -0700
                Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Roedy Green <inquiry@mindprod.com> - 2016-06-13 14:13 -0700
        Re: Sideremark II ( Re: Java Source of Meiyan Hash Scrambler?) Roedy Green <inquiry@mindprod.com> - 2016-06-10 14:11 -0700
      Re: Java Source of Meiyan Hash Scrambler? Roedy Green <inquiry@mindprod.com> - 2016-06-07 20:38 -0700
        Re: Java Source of Meiyan Hash Scrambler? Roedy Green <inquiry@mindprod.com> - 2016-06-09 05:15 -0700
          Re: Java Source of Meiyan Hash Scrambler? Jan Burse <janburse@fastmail.fm> - 2016-06-09 16:26 +0200
            Re: Java Source of Meiyan Hash Scrambler? Roedy Green <inquiry@mindprod.com> - 2016-06-12 02:28 -0700
              Re: Java Source of Meiyan Hash Scrambler? j4n bur53 <janburse@fastmail.fm> - 2016-06-12 12:03 +0200
                Re: Java Source of Meiyan Hash Scrambler? Andreas Leitgeb <avl@logic.at> - 2016-06-13 14:07 +0000
                Re: Java Source of Meiyan Hash Scrambler? Andreas Leitgeb <avl@logic.at> - 2016-06-13 14:17 +0000
                Re: Java Source of Meiyan Hash Scrambler? Andreas Leitgeb <avl@logic.at> - 2016-06-13 14:20 +0000
                Re: Java Source of Meiyan Hash Scrambler? j4n bur53 <janburse@fastmail.fm> - 2016-06-13 16:23 +0200

csiph-web