random: threadlocal generator should be inline

this avoids multiply defined symbols
This commit is contained in:
Danny Robson 2017-09-21 15:58:02 +10:00
parent f06eab9a3a
commit b04f0b0c9e

View File

@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
* Copyright 2016 Danny Robson <danny@nerdcruft.net> * Copyright 2016-2017 Danny Robson <danny@nerdcruft.net>
*/ */
#ifndef CRUFT_UTIL_RANDOM_HPP #ifndef CRUFT_UTIL_RANDOM_HPP
@ -24,7 +24,7 @@ namespace util::random {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/// return correctly initialised thread-local generator of an unspecified, /// return correctly initialised thread-local generator of an unspecified,
/// but not entirely useless, type. ie, not LCG. /// but not entirely useless, type. ie, not LCG.
auto& inline auto&
generator (void) generator (void)
{ {
static thread_local std::mt19937_64 gen { std::random_device {}() }; static thread_local std::mt19937_64 gen { std::random_device {}() };