using Probability Distribution? My assignment deals with CPU-Scheduling and for some purposes I am supposed to come up with a random number between 0 and 40 using Probability Distribution. I googled it but it turns out that the probability distribution would be a number between 0 and 1. What am I missing here?
If you have random number in the range [0.0,1.0) (as a floating point number)
you can generate a random number in the range [a,b) by applying the following algorithm:
1 2 3 4 5
constfloat a = 0.0;
constfloat b = 40.0;
float rand_0_1 = getRand();
float rand_a_b = a + (b-a) * rand_0_1;