NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
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
Declares the global pseudorandom number generator (PRNG) for NFD.
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
std::mt19937 & getGlobalRng()
Definition: random.cpp:32