From f13a66b963d4ecd53dda7866e947bc3230566d63 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Mon, 20 Aug 2018 17:24:13 -0400
Subject: [PATCH] profile_manager: Move UUID generation function to the cpp
 file

This avoids needing to dump the contents of <random> into other files
that include the profile manager header.
---
 src/core/hle/service/acc/profile_manager.cpp | 10 ++++++++++
 src/core/hle/service/acc/profile_manager.h   | 12 ++----------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index fe9921fb6f..9440dc5554 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -2,6 +2,7 @@
 // Licensed under GPLv2 or any later version
 // Refer to the license.txt file included.
 
+#include <random>
 #include <boost/optional.hpp>
 #include "core/hle/service/acc/profile_manager.h"
 #include "core/settings.h"
@@ -12,6 +13,15 @@ constexpr ResultCode ERROR_TOO_MANY_USERS(ErrorModule::Account, -1);
 constexpr ResultCode ERROR_USER_ALREADY_EXISTS(ErrorModule::Account, -2);
 constexpr ResultCode ERROR_ARGUMENT_IS_NULL(ErrorModule::Account, 20);
 
+const UUID& UUID::Generate() {
+    std::random_device device;
+    std::mt19937 gen(device());
+    std::uniform_int_distribution<u64> distribution(1, std::numeric_limits<u64>::max());
+    uuid[0] = distribution(gen);
+    uuid[1] = distribution(gen);
+    return *this;
+}
+
 ProfileManager::ProfileManager() {
     // TODO(ogniK): Create the default user we have for now until loading/saving users is added
     auto user_uuid = UUID{1, 0};
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h
index 314bccbf93..91f6f03a91 100644
--- a/src/core/hle/service/acc/profile_manager.h
+++ b/src/core/hle/service/acc/profile_manager.h
@@ -5,7 +5,7 @@
 #pragma once
 
 #include <array>
-#include <random>
+
 #include "boost/optional.hpp"
 #include "common/common_types.h"
 #include "common/swap.h"
@@ -38,15 +38,7 @@ struct UUID {
     }
 
     // TODO(ogniK): Properly generate uuids based on RFC-4122
-    const UUID& Generate() {
-        std::random_device device;
-        std::mt19937 gen(device());
-        std::uniform_int_distribution<uint64_t> distribution(1,
-                                                             std::numeric_limits<uint64_t>::max());
-        uuid[0] = distribution(gen);
-        uuid[1] = distribution(gen);
-        return *this;
-    }
+    const UUID& Generate();
 
     // Set the UUID to {0,0} to be considered an invalid user
     void Invalidate() {
-- 
GitLab