Random number between 1 to 10 using C++

range * rand() / (RAND_MAX + 1.0)

does not do what you think. Introduce some parens:

range * (rand() / (RAND_MAX + 1.0))

(Note that this method gives skewed distributions, though.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)