Hey,
I had school exercise in which i needed to generate some numbers within the range of 70 to 90. I'd like to know whether there exists an exact formula which allows the numbers to be generated within a particular range.
When I had to generate numbers from 10 to 20, the correct code was :
float a = (float) (Math.random()* 10) +10;
but I can't establish a general rule for all the ranges...
Any ideas pls??
I had school exercise in which i needed to generate some numbers within the range of 70 to 90. I'd like to know whether there exists an exact formula which allows the numbers to be generated within a particular range.
When I had to generate numbers from 10 to 20, the correct code was :
float a = (float) (Math.random()* 10) +10;
but I can't establish a general rule for all the ranges...
Any ideas pls??
Comment