Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Non power of two hash table sizes

Author: Dann Corbit

Date: 11:30:09 02/19/02

Go up one level in this thread


On February 19, 2002 at 14:22:10, David Rasmussen wrote:

>On February 19, 2002 at 01:54:35, Dann Corbit wrote:
>
>>On February 19, 2002 at 01:48:51, David Rasmussen wrote:
>>
>>>
>>>Eh... How about just using the mod operator, %?
>>>
>>>>hashindex = hashkey % hashsize;
>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>You mean like this?
>
>Yep. I didn't see that. I got confused by all the other code :)
>
>I don't believe it is necesary to use a prime-sized hash table, when you have
>such a good hashing function.

Maybe not.  At most, it will cost you a few K of hash table and it is a good
insurance against a crappy rand() or imperfect hash function.  Better safe than
sorry.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.