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/compiler.hh"
57#include "base/types.hh"
58#include "sim/serialize.hh"
59
60class Checkpoint;
61
62class Random : public Serializable
63{
64
65 private:
66
67 std::mt19937_64 gen;
68
69 public:
70

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

99 template <typename T>
100 typename std::enable_if<std::is_integral<T>::value, T>::type
101 random(T min, T max)
102 {
103 std::uniform_int_distribution<T> dist(min, max);
104 return dist(gen);
105 }
106
107 void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
108 void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
109};
110
111extern Random random_mt;
112
113#endif // __BASE_RANDOM_HH__