Boost logo

Boost :

From: John Maddock (jz.maddock_at_[hidden])
Date: 2020-06-17 17:48:04


On 17/06/2020 15:53, Paul A Bristow via Boost wrote:
> I have wanted to use boost::random::random_device; as a seeder for my generator.
>
> #include <boost/random/random_device.hpp> // For boost::random::random_device; seeder
>
> But using this requires that I link to a library file
> // LINK : fatal error LNK1104: cannot open file 'libboost_random-vc142-mt-gd-x64-1_73.lib'
>
> So I have instead used C++ std random device successfully
>
> using std::random_device;
> random_device seeder;
> // Use seeder to get a different set of values each time.
> static boost::random::mt19937 gen(seeder()); // uint32_t
>
> But is there any way I can stick to the Boost version (I imagine that it might prove more portable?
> Or is this a delusion?)

What do you mean by portable?  random_device is inherently non-portable
because it's.... random ;)

In many ways this is something that the std:: version does best as the
system implementer knows best how to implement on their OS.  Or you
could just link to Boost.Random of course which would work nearly
everywhere too I'm sure.

Best, John.

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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