Which is the correct way to generate numbers between minimum and maximum(inclusive)?
(a) minimum + (rand() % (maximum – minimum));
(b) minimum + (rand() % (maximum – minimum + 1));
(c) minimum * (rand() % (maximum – minimum))
(d) minimum – (rand() % (maximum + minimum));
The question was posed to me during a job interview.
The doubt is from Random Number Generation in section Input and Output in C of C