I have stored =RANDBETWEEN(10, 20)
in my excel sheet, this formula generates random values in the excel sheet between 10 to 20. I need to read this 5 random values
You use i
to query the same cell (A1) five times. This value is calculated upon opening / refreshing the worksheet in Excel. Why do you think that querying the same cell in rapid succession would result in something different each time?
I'm not sure why you're relying on Excel for random numbers. Is there a reason you can't generate these in Java directly instead? For example:
// Assuming 20 is your max, 10 your min
Random random = new Random();
int yourRandomNumber = random.nextInt((20 - 10) + 1) + 10;