randomInt(min,max)

Returns a random integer from specified range.


Syntax

o_randomInt(min,max)
return: min <= random integer <= max

Usage

Use this to generate a random integer.

Location

menu: veeos ==> Math ==> randomInt

library: mathLib

Example

o_randomInt(0,34) is equally likely to return any of the 35 integers in the inclusive range of 0 to 34

Notes

This is similar to the built-in random() function, but the built-in returns real64's, this returns integers.

In looking at this function, several approaches were tried, as noted in evalRandomInt.vee. Note that it isn't hard to end up with biased result, and that some approaches are slower than others. Also, as it turns out, the "best" solution in this case is to read the Help and note that the built-in random() function uses a non-inclusive range [A,B) so can be used almost directly.

Reference

Dependencies

Supported On

VEE 7.0+, all platforms

See Also

randomReorder


© 2015-2025. All Rights Reserved. Stan Bischof (stan@worldbadminton.com). Last updated 03 February 2023 13:03.