Description
The Int
method is an extension method for the System.Random
class, provided by the Sandbox.SandboxSystemExtensions
class. It generates a random integer within a specified range, inclusive of the minimum value and exclusive of the maximum value.
Usage
To use the Int
method, you need to have an instance of System.Random
. You can then call this method on the instance, passing the minimum and maximum bounds for the random integer you want to generate.
Ensure that the min
parameter is less than the max
parameter to avoid an ArgumentOutOfRangeException
.
Example
// Example usage of the Int extension method
Random random = new Random();
int randomNumber = random.Int(1, 10);
// randomNumber will be a random integer between 1 (inclusive) and 10 (exclusive)