diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2016-02-24 16:37:33 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-02-25 00:38:13 +0100 |
commit | 7564c89360d4739df106c1184131df1add1721d3 (patch) | |
tree | 2e688b0662a00fb23ec94959e8ade3455ed606a5 /subsurface-desktop-main.cpp | |
parent | 2b8e8849e64e8237eeef7d632bde245f8ef218a1 (diff) | |
download | subsurface-7564c89360d4739df106c1184131df1add1721d3.tar.gz |
Initialize the random number generator
We use random numbers for file names, both temporary filename when
creating a zip for divelogs.de upload and for filename on form data for
facebook upload. This does not require for true randomness but we still
want these to not be constant on each run of Subsurface. Thus we need to
initialize the random number generator.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-desktop-main.cpp')
-rw-r--r-- | subsurface-desktop-main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index d084f2a5f..2b7bf89f6 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -64,6 +64,14 @@ int main(int argc, char **argv) #else git_libgit2_init(); #endif + /* + * Initialize the random number generator - not really secure as + * this is based only on current time, but it should not matter + * that much in our context. Moreover this is better than + * the constant numbers we used to get before. + */ + qsrand(time(NULL)); + setup_system_prefs(); copy_prefs(&default_prefs, &prefs); fill_profile_color(); |