Eric Martin 3225470df5 Merge pull request #8125 from eugenp/revert-8119-BAEL-3275-2
Revert "BAEL-3275: Using blocking queue for pub-sub"
2019-10-31 20:43:47 -05:00

23 lines
565 B
Java

package com.baeldung.numbersinrange;
import java.util.Random;
public class RandomNumbersInARange {
public int getRandomNumber(int min, int max) {
return (int) ((Math.random() * (max - min)) + min);
}
public int getRandomNumberUsingNextInt(int min, int max) {
Random random = new Random();
return random.nextInt(max - min) + min;
}
public int getRandomNumberUsingInts(int min, int max) {
Random random = new Random();
return random.ints(min, max)
.findFirst()
.getAsInt();
}
}