why cant i generate a random number of type double?

hey guys i wrote this code and i want to generate randome numbers of type double. i dont know how to do that.
it keeps giving me an error saying illegal type operand has type double. any idea how to do that? thank you in advance
Last edited on
double rand = (double)rand() / (double)rand();
random numbers of type double are normally generated with std::uniform_real_distribution and similar functions:
http://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution
http://cplusplus.com/reference/random/uniform_real_distribution/

You'd have to show your code to get help with your specific error.
static_cast<double>(non-double variable)

This will turn an int into a double.
thank you guys :)
Topic archived. No new replies allowed.