Bug#762450: kmahjongg: invocation of qrand() without first invoking qsrand()
Package: kmahjongg
Version: 4:4.14.0-1
Severity: normal
Tags: upstream
Dear Maintainer,
kmahjongg provides a configuration option which claims to make it select
random board layouts when starting a new game.
This option selects a board layout using the following statement:
return tilesAvailable.at(qrand() % tilesAvailable.size());
However, at no point does kmahjongg call the qsrand() function, which is
required in order to *initialize* the pseudorandom number generator invoked
via qrand().
The visible symptom of this bug is that when launching the game with the
"random boards" configuration option enabled, the board selected is *almost
always* the same.
(The arrangement of the individual tiles *within* the layout is correctly
randomized, since that task is done using an object of class KRandomSequence,
whose constructor forces it to be correctly initialized.)
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.14-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages kmahjongg depends on:
ii kde-runtime 4:4.13.1-1
ii kdegames-mahjongg-data 4:4.13.1-1
ii libc6 2.19-11
ii libkdecore5 4:4.14.0-1
ii libkdegames6abi1 4:4.13.1-1
ii libkdegamesprivate1abi1 4:4.13.1-1
ii libkdeui5 4:4.14.0-1
ii libkio5 4:4.14.0-1
ii libkmahjongglib4 4:4.13.1-1
ii libqtcore4 4:4.8.6+git64-g5dc8b2b+dfsg-2
ii libqtgui4 4:4.8.6+git64-g5dc8b2b+dfsg-2
ii libstdc++6 4.9.1-14
Versions of packages kmahjongg recommends:
ii khelpcenter4 4:4.13.1-1
kmahjongg suggests no packages.
-- no debconf information
Reply to: