From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Simple hash or pseudo-random function
Date: Mon, 16 Jul 2018 19:17:48 +0200
Date: 2018-07-16T19:17:48+02:00 [thread overview]
Message-ID: <piijvs$u7k$1@dont-email.me> (raw)
In-Reply-To: <5a66cd8a-e11d-4a59-bce1-8cc693b4160a@googlegroups.com>
On 07/16/2018 10:20 AM, gautier_niouzes@hotmail.com wrote:
>
> Does someone have a function that would take an integer (range 0 .. 2**63), not uniformily distributed (it's a code with some meaning) and return a number that is pseudo-random, uniformily distributed (could be a floating-point number or an integer in a range of minimum length 365) ?
> 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 :-) ).
Not sure what you mean by "an integer in a range of minimum length 365". You
could simply use a RNG to generate 64-bit values and xor them with your values
if you want a 64-bit result. By setting the initial seed, the sequence would be
repeatable. Ada.Numerics.Discrete_Random would probably serve. If it's too slow,
the PragmAda Reusable Components includes KISS, a very fast, pretty good RNG. It
produces 32-bit values, so you'd probably need to call it twice.
--
Jeff Carter
"If you don't get the President of the United States on that
phone, ... you're going to have to answer to the Coca-Cola
Company."
Dr. Strangelove
32
next prev parent reply other threads:[~2018-07-16 17:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-16 8:20 Simple hash or pseudo-random function gautier_niouzes
2018-07-16 13:34 ` Shark8
2018-07-17 4:44 ` robin.vowels
2018-07-16 14:52 ` Marius Amado-Alves
2018-07-16 20:59 ` gautier_niouzes
2018-07-16 17:17 ` Jeffrey R. Carter [this message]
2018-07-16 21:14 ` gautier_niouzes
2018-07-17 6:09 ` Jeffrey R. Carter
2018-07-18 13:38 ` gautier_niouzes
2018-08-01 9:08 ` gautier_niouzes
2018-07-17 0:40 ` Dan'l Miller
2018-07-17 6:44 ` Paul Rubin
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox