Fix warning: implicit conversion from 'int' to 'float'

changes value from 2147483647 to 2147483648
/* The largest number rand will return (same as INT_MAX).  */
#define	RAND_MAX	2147483647

(static_cast<float>(quint32) / int * 8)
why cast an int to a float to then divide by an int?

just divide the int by an int.
This commit is contained in:
Simon De Backer
2020-12-05 08:24:35 +01:00
parent ebe22f1131
commit cffec76018

View File

@@ -113,7 +113,7 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
#pragma message("@TODO remove code for QT 5.10 or later")
#endif
quint32 value = QRandomGenerator::global()->generate();
QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( value ) / RAND_MAX * 10 ) );
QThread::sleep(8 + static_cast<unsigned long>(value / RAND_MAX * 10));
#endif
}