Deleted Added
sdiff udiff text old ( 10349:939094c17866 ) new ( 10905:a6ca6831e775 )
full compact
1/*
2 * Copyright (c) 2014 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 39 unchanged lines hidden (view full) ---

48
49#ifndef __BASE_RANDOM_HH__
50#define __BASE_RANDOM_HH__
51
52#include <random>
53#include <string>
54#include <type_traits>
55
56#include "base/types.hh"
57
58class Checkpoint;
59
60class Random
61{
62
63 private:
64
65 std::mt19937_64 gen;
66
67 public:
68

--- 28 unchanged lines hidden (view full) ---

97 template <typename T>
98 typename std::enable_if<std::is_integral<T>::value, T>::type
99 random(T min, T max)
100 {
101 std::uniform_int_distribution<T> dist(min, max);
102 return dist(gen);
103 }
104
105 void serialize(std::ostream &os);
106 void unserialize(Checkpoint *cp, const std::string &section);
107};
108
109extern Random random_mt;
110
111#endif // __BASE_RANDOM_HH__