From 5a2d871a2b480c9237b51e910a5d71d91418dfbb Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 29 Apr 2005 15:01:03 +0000 Subject: 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 --- gob/gob.h | 2 +- gob/init.cpp | 1 - gob/util.cpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'gob') 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() { -- cgit v1.2.3