package com.mavlushechka.a1qa.utils; import java.util.OptionalInt; import java.util.Random; public class IntegerUtils { private IntegerUtils() { } public static int getRandomNumber(int min, int max) { OptionalInt randomNumber = new Random().ints(min, max).findFirst(); if (randomNumber.isPresent()) { return randomNumber.getAsInt(); } LoggerUtils.error("Incorrect min and max arguments."); throw new IllegalArgumentException("Incorrect min and max arguments."); } }