aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-04-29 15:01:03 +0000
committerTorbjörn Andersson2005-04-29 15:01:03 +0000
commit5a2d871a2b480c9237b51e910a5d71d91418dfbb (patch)
treed2e94610fa8c6a57da6a1c548a972ddda5d783a1
parent9bd7d78199341c0698c0047eff0228f3fdc9f1a1 (diff)
downloadscummvm-rg350-5a2d871a2b480c9237b51e910a5d71d91418dfbb.tar.gz
scummvm-rg350-5a2d871a2b480c9237b51e910a5d71d91418dfbb.tar.bz2
scummvm-rg350-5a2d871a2b480c9237b51e910a5d71d91418dfbb.zip
Replaced rand()/srand() with RandomSource. Of course, util_getRandom() is a
pretty unnecessary function - we could call RandomSource directly - but let's take this one thing at a time. svn-id: r17863
-rw-r--r--gob/gob.h2
-rw-r--r--gob/init.cpp1
-rw-r--r--gob/util.cpp2
3 files changed, 2 insertions, 3 deletions
diff --git a/gob/gob.h b/gob/gob.h
index a0a9878dd5..fe4ecbe697 100644
--- a/gob/gob.h
+++ b/gob/gob.h
@@ -51,7 +51,7 @@ public:
void shutdown();
-
+ Common::RandomSource _rnd;
};
extern GobEngine *_vm;
diff --git a/gob/init.cpp b/gob/init.cpp
index 7c72dc03f2..2a972ef52c 100644
--- a/gob/init.cpp
+++ b/gob/init.cpp
@@ -68,7 +68,6 @@ void init_soundVideo(int32 smallHeap, int16 flag) {
videoMode);
pFileHandler = 0;
- srand(0);
//if ((flag & 4) == 0)
// vid_findVideo();
diff --git a/gob/util.cpp b/gob/util.cpp
index ad5198a693..9596d38215 100644
--- a/gob/util.cpp
+++ b/gob/util.cpp
@@ -126,7 +126,7 @@ int16 util_checkKey(void) {
}
int16 util_getRandom(int16 max) {
- return ((int32)rand() * max) / (RAND_MAX + 1);
+ return _vm->_rnd.getRandomNumber(max - 1);
}
void util_processInput() {