summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/Random.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/utils/Random.h')
-rw-r--r--xbmc/utils/Random.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/xbmc/utils/Random.h b/xbmc/utils/Random.h
new file mode 100644
index 0000000..ac2a073
--- /dev/null
+++ b/xbmc/utils/Random.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include <algorithm>
12#include <random>
13
14namespace KODI
15{
16namespace UTILS
17{
18template<class TIterator>
19void RandomShuffle(TIterator begin, TIterator end)
20{
21 std::random_device rd;
22 std::mt19937 mt(rd());
23 std::shuffle(begin, end, mt);
24}
25}
26}