Double can represent too many decimal places, so in terms of probability, the chance of randomly generating var2 is too small, so the author is advised to ignore it. If you only take a fixed number of decimal places, such as 2 decimal places, you can do this:
// 取[1.20, 1.30]
long n = random.longs(1, 120, 130 + 1).findFirst().orElse(0);
// 将n的小数点左移两位
Solution:
random.doubles(1, var1, var2 + Double.MIN_VALUE).findFirst().orElse(0);
Double can represent too many decimal places, so in terms of probability, the chance of randomly generating var2 is too small, so the author is advised to ignore it. If you only take a fixed number of decimal places, such as 2 decimal places, you can do this: