Generating random numbers

I keep getting invalid operands to binary expression ('double' and 'double').
I tried to solve it myself, but no cigar.
What I am trying to do is populate an array with random numbers form 0.01 to 10.99.
Please help me with only the rand function.



 
  price[i]= rand() %  (10.99) +( 0.01);
try double j = (double)(rand()%1099+1)/100;. Your code doesn't work because % only works with int divisors.
hey i don't know if this is solved yet but i like to use

this will give you between 0 and 4

float tmp = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / 4));
Thank you guys both for your help it helped me solve it.
Topic archived. No new replies allowed.