diff options
author | Max Horn | 2003-10-14 10:24:27 +0000 |
---|---|---|
committer | Max Horn | 2003-10-14 10:24:27 +0000 |
commit | 0aa58f53c881b541c603f0c1d2e4650db3930f88 (patch) | |
tree | 27749df583990b0705e9bd9af6d0044fea7f1a50 /common | |
parent | e9dacde3c596ff22fb12db3eeb1ddf2e2d3982a8 (diff) | |
download | scummvm-rg350-0aa58f53c881b541c603f0c1d2e4650db3930f88.tar.gz scummvm-rg350-0aa58f53c881b541c603f0c1d2e4650db3930f88.tar.bz2 scummvm-rg350-0aa58f53c881b541c603f0c1d2e4650db3930f88.zip |
init RNG for everybody using time()
svn-id: r10796
Diffstat (limited to 'common')
-rw-r--r-- | common/util.cpp | 6 | ||||
-rw-r--r-- | common/util.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/common/util.cpp b/common/util.cpp index 5c85e74c70..cdb9bf9c60 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -75,8 +75,10 @@ void hexdump(const byte * data, int len, int bytesPerLine) { printf("|\n"); } -RandomSource::RandomSource(uint32 seed) { - _randSeed = seed; +RandomSource::RandomSource() { + // Use system time as RNG seed. Normally not a good idea, if you are using + // a RNG for security purposes, but good enough for our purposes. + setSeed(time(0)); } void RandomSource::setSeed(uint32 seed) { diff --git a/common/util.h b/common/util.h index a62511d6da..760ad25a08 100644 --- a/common/util.h +++ b/common/util.h @@ -55,7 +55,7 @@ private: uint32 _randSeed; public: - RandomSource(uint32 seed = 0xA943DE33); + RandomSource(); void setSeed(uint32 seed); /** |