build: don't fully qualify the installation path

This commit is contained in:
Danny Robson 2019-06-18 15:10:05 +10:00
parent 70fcf1e97d
commit c64cd2eb29
2 changed files with 16 additions and 3 deletions

View File

@ -727,7 +727,7 @@ install (
FILES FILES
"${CMAKE_CURRENT_BINARY_DIR}/libcruft.pc" "${CMAKE_CURRENT_BINARY_DIR}/libcruft.pc"
DESTINATION DESTINATION
"${CMAKE_INSTALL_PREFIX}/share/pkgconfig" "share/pkgconfig"
) )

View File

@ -16,6 +16,8 @@
#include <limits> #include <limits>
#include <type_traits> #include <type_traits>
#include <chrono>
namespace cruft::random { namespace cruft::random {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -25,8 +27,19 @@ namespace cruft::random {
initialise (void) initialise (void)
{ {
// Approximate the state size of the generator by its size in bytes. // Approximate the state size of the generator by its size in bytes.
std::array<unsigned,sizeof (GeneratorT) / sizeof (unsigned) + 1> seed; std::array<unsigned,sizeof (GeneratorT) / sizeof (unsigned) + 1 + 1> seed;
std::generate (seed.begin (), seed.end (), std::random_device ()); std::generate_n (
seed.begin (),
seed.size () - 1,
std::random_device ()
);
// Append the current time with the highest resolution we have
// available. This defends against instances where the implementation
// of std::random_device is actually deterministic.
seed[seed.size () - 1] = static_cast<unsigned> (
std::chrono::high_resolution_clock::now ().time_since_epoch ().count ()
);
std::seed_seq seq (seed.begin (), seed.end ()); std::seed_seq seq (seed.begin (), seed.end ());
return GeneratorT (seq); return GeneratorT (seq);