random.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #include "random.hpp"
27 #include <boost/thread/tss.hpp>
28 
29 namespace nfd {
30 
31 std::mt19937&
33 {
34  static boost::thread_specific_ptr<std::mt19937> rng;
35  if (rng.get() == nullptr) {
36  std::random_device rd;
37  rng.reset(new std::mt19937(rd()));
38  }
39  return *rng;
40 }
41 
42 } // namespace nfd
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
std::mt19937 & getGlobalRng()
Definition: random.cpp:32
Declares the global pseudorandom number generator (PRNG) for NFD.