From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: Simple hash or pseudo-random function Date: Mon, 16 Jul 2018 23:44:12 -0700 Organization: A noiseless patient Spider Message-ID: <87o9f6pdj7.fsf@nightsong.com> References: <5a66cd8a-e11d-4a59-bce1-8cc693b4160a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: h2725194.stratoserver.net; posting-host="78cf2c98f59dd8f751126382ec31993c"; logging-data="13965"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fp0iUciLsxUfezEadAhH3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cancel-Lock: sha1:XygZ6W84wKdgFKqIUtkyN6mfKs8= sha1:21fWWau6yy9aXJJjPiBHz/r3lkE= Xref: reader02.eternal-september.org comp.lang.ada:53863 Date: 2018-07-16T23:44:12-07:00 List-Id: gautier_niouzes@hotmail.com writes: > The difficulty for me is to find a very simple function. There are > many that are for hashing strings, but they could be too > time-consuming: it's for a number-crunching program where this > function will be called billions of times, so I'm looking for > something really simple (and fast :-) ). String-hashing functions can be very fast, and if you're -really- all out for speed, there might be machine intrinsics that you could use. Also you can take the exact characteristics of the input and output into account when optimizing. >From your description "not uniformily distributed (it's a code with some meaning)", this may be of interest: https://en.wikipedia.org/wiki/Zobrist_hashing