Boost logo

Boost :

Subject: Re: [boost] Removing auto_ptr/etc. from Boost
From: Peter Dimov (lists_at_[hidden])
Date: 2015-03-19 12:03:13

Andrey Semashev wrote:
> Looking at Boost.Random, creating RNG involves seed generation, which is
> probably one or several syscalls, let alone any possible resource
> allocations.

Creating what type of RNG?

> This has to be done on each call to shuffle, if I understand correctly.

Well, it depends, you can keep the URNG around if you like. You don't have
to recreate it before each call.

> Compare that with rand(), which is presumably purely computational and
> never fails.

I would expect rand() to take a lock (or use an atomic compare/exchange)
under implementations that don't make it thread-specific, so it should be
slower than a simple local RNG. Even a thread-local rand() should be
slightly slower, in principle.

Boost list run by bdawes at, gregod at, cpdaniel at, john at