In addition, you can create a value from the range float [a, b), with the exception of b:
r := random; x := (ba)*r + a;
The first line generates a value from [0; 1) interval; the second gives the value from [a, b).
If you want to get N random values ββin the interval [a; b] (for example, 5 random values ββfrom the interval [1; 2]: {1, 1.25, 1.5, 1.75, 2}) use the following:
r := RandomRange(0, N-1); x := a + r*(ba)/(N-1);
Ivan Z
source share