I need to generate random numbers using Math.random() between two given values but ignoring on this comparation the two given values or just one depending the case.
Those are the values to do:
Between -7 and 0, excluding 0.
Between 0 and 4, both of the values excluded.
Between 4 and 5, excluding 4.
I've tried with the first case the following code:
double fv = (-7) + Math.random() * (0 -7);
System.out.println(fv);
But it's giving me weird resoults like -13.00123.
It's for a degree excercise so I have to keep it simple.
Any ideas?