[Qt-interest] Best Random Number Generator in Qt

Aaron Lewis aaron.lewis1989 at gmail.com
Thu Apr 15 14:05:35 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
	For example , i'd like to get a integer range from 0 to max , i can use
such a function:

int mpainter::getRandomNumber(int max)
{
    return double(qrand()) / RAND_MAX * max;
}

But i don't think this is a good way to generate it , i always got a
number two.

Is there any good method to generate random number in range ?

Appreciate any of your help ;-)

- -- 
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4r0n on freenode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvHAQ8ACgkQvf41sEptMqDEIgCfZYyF2NIR3sEr+/ldA5vSWVxt
84EAnibCo5O54pDnw5W3EY0E5hPWTXL5
=SrC/
-----END PGP SIGNATURE-----



More information about the Qt-interest-old mailing list