random.cc (10349:939094c17866) random.cc (10905:a6ca6831e775)
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

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

65
66void
67Random::init(uint32_t s)
68{
69 gen.seed(s);
70}
71
72void
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

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

65
66void
67Random::init(uint32_t s)
68{
69 gen.seed(s);
70}
71
72void
73Random::serialize(std::ostream &os)
73Random::serialize(CheckpointOut &cp) const
74{
75 panic("Currently not used anywhere.\n");
76
77 // get the state from the generator
78 std::ostringstream oss;
79 oss << gen;
80 std::string state = oss.str();
74{
75 panic("Currently not used anywhere.\n");
76
77 // get the state from the generator
78 std::ostringstream oss;
79 oss << gen;
80 std::string state = oss.str();
81 paramOut(os, "mt_state", state);
81 paramOut(cp, "mt_state", state);
82}
83
84void
82}
83
84void
85Random::unserialize(Checkpoint *cp, const std::string &section)
85Random::unserialize(CheckpointIn &cp)
86{
87 panic("Currently not used anywhere.\n");
88
89 // the random generator state did not use to be part of the
90 // checkpoint state, so be forgiving in the unserialization and
91 // keep on going if the parameter is not there
92 std::string state;
86{
87 panic("Currently not used anywhere.\n");
88
89 // the random generator state did not use to be part of the
90 // checkpoint state, so be forgiving in the unserialization and
91 // keep on going if the parameter is not there
92 std::string state;
93 if (optParamIn(cp, section, "mt_state", state)) {
93 if (optParamIn(cp, "mt_state", state)) {
94 std::istringstream iss(state);
95 iss >> gen;
96 }
97}
98
99Random random_mt;
94 std::istringstream iss(state);
95 iss >> gen;
96 }
97}
98
99Random random_mt;