The random number function generates a double precision number between 0 and 1. So you need to perform math on the output to scale it and offset it to the range you want. You say you only want numbers above 40, but how high above 40 do you want to go? Do you want them to be integers or real numbers? All of this will determine what kind of math you need to do on the output.
For example, if you want real numbers between 40 and 100, you will need take the random number, multiply by 60, then add 40 to get that result.