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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a02:711a:: with SMTP id n26-v6mr8338882jac.14.1531775649594; Mon, 16 Jul 2018 14:14:09 -0700 (PDT) X-Received: by 2002:aca:75c9:: with SMTP id q192-v6mr4147508oic.3.1531775649437; Mon, 16 Jul 2018 14:14:09 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!feeder4.usenet.farm!feed.usenet.farm!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!d7-v6no5616708itj.0!news-out.google.com!l67-v6ni128itl.0!nntp.google.com!d7-v6no5616706itj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 16 Jul 2018 14:14:09 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:1206:45c6:8b20:c93d:de3b:b486:f18; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG NNTP-Posting-Host: 2a02:1206:45c6:8b20:c93d:de3b:b486:f18 References: <5a66cd8a-e11d-4a59-bce1-8cc693b4160a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <979df026-05c7-447b-b5eb-010d85d61813@googlegroups.com> Subject: Re: Simple hash or pseudo-random function From: gautier_niouzes@hotmail.com Injection-Date: Mon, 16 Jul 2018 21:14:09 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:53852 Date: 2018-07-16T14:14:09-07:00 List-Id: Le lundi 16 juillet 2018 19:17:49 UTC+2, Jeffrey R. Carter a =C3=A9crit=C2= =A0: > Not sure what you mean by "an integer in a range of minimum length 365". = You=20 > could simply use a RNG to generate 64-bit values and xor them with your v= alues=20 > if you want a 64-bit result. By setting the initial seed, the sequence wo= uld be=20 > repeatable. Ada.Numerics.Discrete_Random would probably serve. If it's to= o slow,=20 > the PragmAda Reusable Components includes KISS, a very fast, pretty good = RNG. It=20 > produces 32-bit values, so you'd probably need to call it twice. The 64-bit value is the *input* and the output is a function of that input = only. e.g. 10562032 gives always 211 31375393 gives always 31 85232830 gives always 172 NB: the input codes can appear in a different order, so a pseudo-random *se= quence* cannot be used. I've tested different RNG's by initializing them with the input code and us= ing only the first pseudo-random value using that seed. The good news is th= at they seem uniformly distributed even with successive seed values, but th= ey are not random enough when seeds are similar. I'll check Marius' solutio= n, or a hash function like CRC.