How to set random number generator to a range?

Is there any way I can use random number generator with negative numbers? thanks
Last edited on
Generate between 0 and 2000 and then subtract 1000?

By the way, rand() and friends are deprecated - don't use them anymore. Instead, learn how to use the new C++11 <random> header:
http://www.cplusplus.com/reference/random/
http://en.cppreference.com/w/cpp/header/random

Check out this example:
http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution#Example
Topic archived. No new replies allowed.