summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar David Marcec2018-08-12 02:31:43 +1000
committerGravatar David Marcec2018-08-12 02:31:43 +1000
commit10f494eefead7b2da17d8095abdfaad9ff9290fb (patch)
tree268b35667b3d77f1eb12940f9f66fb4894de82d1 /src
parentRemoved un-needed count from ListOpenUsers and ListAllUsers (diff)
downloadyuzu-10f494eefead7b2da17d8095abdfaad9ff9290fb.tar.gz
yuzu-10f494eefead7b2da17d8095abdfaad9ff9290fb.tar.xz
yuzu-10f494eefead7b2da17d8095abdfaad9ff9290fb.zip
Better UUID randomness
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/acc/profile_manager.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h
index 908519095..314bccbf9 100644
--- a/src/core/hle/service/acc/profile_manager.h
+++ b/src/core/hle/service/acc/profile_manager.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include <random>
8#include "boost/optional.hpp" 9#include "boost/optional.hpp"
9#include "common/common_types.h" 10#include "common/common_types.h"
10#include "common/swap.h" 11#include "common/swap.h"
@@ -38,8 +39,12 @@ struct UUID {
38 39
39 // TODO(ogniK): Properly generate uuids based on RFC-4122 40 // TODO(ogniK): Properly generate uuids based on RFC-4122
40 const UUID& Generate() { 41 const UUID& Generate() {
41 uuid[0] = (static_cast<u64>(std::rand()) << 32) | std::rand(); 42 std::random_device device;
42 uuid[1] = (static_cast<u64>(std::rand()) << 32) | std::rand(); 43 std::mt19937 gen(device());
44 std::uniform_int_distribution<uint64_t> distribution(1,
45 std::numeric_limits<uint64_t>::max());
46 uuid[0] = distribution(gen);
47 uuid[1] = distribution(gen);
43 return *this; 48 return *this;
44 } 49 }
45 50