Boost logo

Boost :

Subject: Re: [boost] [random] new threefry random engine
From: John Salmon (john_at_[hidden])
Date: 2014-04-29 18:12:29


On Wed, Apr 23, 2014 at 11:06 AM, Peter Dimov <lists_at_[hidden]> wrote:

A RandomFunction is basically a high-grade hash function, right? If so, it
> might be worth investigating whether to switch Boost.Hash to use the
> threefry random function. There are people who find it inconvenient that
> hash_value( 5 ) is 5 and would rather prefer a "random" output.
>
>
Yes, the pseudo-random functions are high-grade hash functions if you use
the "full" number of rounds, and they're "low-grade" hash funcions if you
use fewer rounds. They actually start to "look" random after only a couple
of rounds, which might be enough for the purposes of indexing into a hash
table. I put a tiny example at

https://github.com/DEShawResearch/Random123-Boost/blob/master/libs/random/examples/philox_hash_value.cpp

John Salmon


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk