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

◆ next() [4/6]

template<typename value_t >
value_t xtd::random::next ( value_t  max_value) const
inline

Returns a nonnegative random number less than the specified maximum.

Parameters
max_valueThe exclusive upper bound of the random number to be generated. max_value must be greater than or equal to zero.
Returns
A value_t greater than or equal to zero and less than max_value
Exceptions
argument_out_of_range_exceptionmax_value is less than zero.
Remarks
The next(value_t) overload returns random integers that range from 0 to max_value – 1. However, if max_value is 0, the method returns 0.