public static long nextLong(final long startInclusive, final long endExclusive) {
        Validate.isTrue(endExclusive >= startInclusive,
                "Start value must be smaller or equal to end value.");
        Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative.");

        if (startInclusive == endExclusive) {
            return startInclusive;
        }

        return (long) nextDouble(startInclusive, endExclusive);
    }
public static long nextLong ( final long startInclusive , final long endExclusive ) { Validate . isTrue ( endExclusive >= startInclusive , "Start value must be smaller or equal to end value." ) ; Validate . isTrue ( startInclusive >= 0 , "Both range values must be non-negative." ) ; if ( startInclusive == endExclusive ) { return startInclusive ; } return ( long ) nextDouble ( startInclusive , endExclusive ) ; }
<p>
Returns a random long within the specified range.
</p>

@param startInclusive
the smallest value that can be returned, must be non-negative
@param endExclusive
the upper bound (not included)
@throws IllegalArgumentException
if {@code startInclusive > endExclusive} or if
{@code startInclusive} is negative
@return the random long