xtd 0.2.0
Loading...
Searching...
No Matches

◆ next() [5/6]

virtual int32 xtd::random::next ( int32  min_value,
int32  max_value 
) const
virtual

Returns a random number within a specified range.

Parameters
min_valueThe inclusive lower bound of the random number returned
max_valueThe exclusive upper bound of the random number returned. max_value must be greater than or equal to min_value.
Returns
A 32-bit signed integer greater than or equal to min_value and less than max_value
Exceptions
argument_out_of_range_exceptionmin_value is greater than max_value.
Remarks
The next(int32, int32) overload returns random integers that range from min_value to max_value – 1. However, if max_value equals min_value, the method returns min_value.
Unlike the other overloads of the next method, which return only non-negative values, this method can return a negative random integer.