diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-03-18 11:47:15 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-03-18 11:47:15 -0700 |
commit | cc14689a86d4a17bc8d8c77a24539d45e7f78da9 (patch) | |
tree | 8f26ac204951a13431a3d575095a8e46bf2b9cdf /src/python/swig/core.i | |
parent | 38aa50bb49ac8621fe9cc6a85ad6f39a61c76bb3 (diff) | |
download | gem5-cc14689a86d4a17bc8d8c77a24539d45e7f78da9.tar.xz |
swig: get rid of m5.internal.random module (swig/random.i)
Thanks to swig this was interfering with the standard Python
random module. The only function in that module was seed(),
which erroneously called srand48(). Moved the function to
m5.internal.core, renamed it seedRandom(), and made it call
random_mt.init() instead.
Diffstat (limited to 'src/python/swig/core.i')
-rw-r--r-- | src/python/swig/core.i | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/python/swig/core.i b/src/python/swig/core.i index b8f70039d..ffaf84476 100644 --- a/src/python/swig/core.i +++ b/src/python/swig/core.i @@ -35,6 +35,7 @@ #include "python/swig/pyobject.hh" #include "base/misc.hh" +#include "base/random.hh" #include "base/socket.hh" #include "base/types.hh" #include "sim/core.hh" @@ -54,6 +55,13 @@ const bool flag_NDEBUG = false; const bool flag_TRACING_ON = TRACING_ON; inline void disableAllListeners() { ListenSocket::disableAll(); } + +inline void +seedRandom(uint64_t seed) +{ + random_mt.init(seed); +} + %} %include <stdint.i> @@ -64,6 +72,7 @@ inline void disableAllListeners() { ListenSocket::disableAll(); } void setOutputDir(const std::string &dir); void doExitCleanup(); void disableAllListeners(); +void seedRandom(uint64_t seed); %immutable compileDate; char *compileDate; |