mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kdirshare: use KRandom::randomMax() for less round-trips
feels like a new KRandom::randomRange() method is needed Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a408a397a5
commit
77453ce6e9
1 changed files with 4 additions and 2 deletions
|
@ -26,6 +26,7 @@
|
|||
#include <kconfiggroup.h>
|
||||
#include <knotification.h>
|
||||
#include <kdirnotify.h>
|
||||
#include <krandom.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
|
@ -35,8 +36,9 @@ static quint16 getPort(const quint16 portmin, const quint16 portmax)
|
|||
return portmax;
|
||||
}
|
||||
quint16 portnumber = 0;
|
||||
while (portnumber < portmin || portnumber > portmax) {
|
||||
portnumber = quint16(qrand());
|
||||
while (portnumber < portmin) {
|
||||
portnumber = quint16(KRandom::randomMax(portmax));
|
||||
Q_ASSERT(portnumber <= portmax);
|
||||
}
|
||||
return portnumber;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue