face: Fixing face registration protocol by ensuring uniqueness of each command interest

This commit also introduces a new helper ndn::random::generateWord32()
to generate random 32-bit integer (currently using CryptoPP functions).

Change-Id: I7bd32875cbdd98eea793aa5d8270f8091b7c1a6b
diff --git a/src/util/random.cpp b/src/util/random.cpp
new file mode 100644
index 0000000..5ef2ffc
--- /dev/null
+++ b/src/util/random.cpp
@@ -0,0 +1,35 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "random.hpp"
+
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreorder"
+#pragma clang diagnostic ignored "-Wtautological-compare"
+#pragma clang diagnostic ignored "-Wunused-variable"
+#pragma clang diagnostic ignored "-Wunused-function"
+#elif __GNUC__
+#pragma GCC diagnostic ignored "-Wreorder"
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
+#include <cryptopp/osrng.h>
+
+namespace ndn {
+namespace random {
+
+uint32_t
+generateWord32()
+{
+  static CryptoPP::AutoSeededRandomPool rng;
+
+  return rng.GenerateWord32();
+}
+
+} // namespace random
+} // namespace ndn