Reputation: 1863
I need to get random numbers between 0 and 1. As 0.54321, 0.8912, 0.1234342, 0.0000123 and etc
I put this code in my main and also Application constructor:
qsrand(QDateTime::currentDateTime().toTime_t());
And used this code inside one of my slots:
float prob = qrand() % 1;
I tried int, double as a return value, but it is always returning 0.
Any ideas what is going on?
Thanks
Upvotes: 0
Views: 1022