The % operator does not work on doubles. Your best bet for generating a double is going to be generating individual place values and the adding them together. Here is an example:
#include <iostream>
#include <time.h>
using namespace std;
int main() {
srand(time(0));
double random;
random = (rand() % 3) + .1*(rand() % 10) + .01*(rand() % 10);
cout.precision(2);
cout << fixed <<random;
}
This code would generate a random float between 0.00 and 2.99
EDIT: After thinking about this for about two seconds I realized there is a much better way of doing this. If you just generate a integer with digits equal to the amount of significant figures you need and divide that down you will get a random double.
double randDouble(double precision, double lowerBound, double upperBound) {
double random;
random = static_cast<double>(((rand()%(static_cast<int>(std::pow(10,precision)*(upperBound - lowerBound) + 1))) + lowerBound*std::pow(10,precision)))/std::pow(10,precision);
return random;
}