Xojo.Math.RandomInt

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

Xojo.Math.RandomInt(min As Int64, max As Int64) As Int64

Supported for all project types and targets.

Returns a random integer in the given range (inclusive).

Notes

Uses the mersenne twister engine (aka PRNG) with the seed set using std::random_device.

fa-exclamation-circle-32.png
An InvalidArgumentException will be raised if min is greater than max.

Sample Code

Using Xojo.Math
Dim num As Int64 = RandomInt(10, 50)