We can use org.apache.commons.lang3.RandomUtils to generate random numbers using a single line.
int x = RandomUtils.nextInt(1, 1000);
The method nextInt(int startInclusive, int endExclusive) takes a range.
Apart from int, we can generate random long, double, float and bytes using this class.
R...