nextInt method - Random class - dart:math library (original) (raw)

description

nextInt abstract method

int nextInt(

  1. int max )

Generates a non-negative random integer uniformly distributed in the range from 0, inclusive, to max, exclusive.

Implementation note: The default implementation supports max values between 1 and (1<<32) inclusive.

Example:

var intValue = Random().nextInt(10); // Value is >= 0 and < 10.
intValue = Random().nextInt(100) + 50; // Value is >= 50 and < 150.

Implementation

int nextInt(int max);