Подтвердить что ты не робот

Как получить случайное число из диапазона в дротике?

Как получить случайное число в диапазоне, близком к С# Random.Next(int min, int max);

4b9b3361

Ответ 1

import 'dart:math';

final _random = new Random();

/**
 * Generates a positive random integer uniformly distributed on the range
 * from [min], inclusive, to [max], exclusive.
 */
int next(int min, int max) => min + _random.nextInt(max - min);

Ответ 2

Диапазон можно найти с помощью простой формулы следующим образом

Random rnd;
int min = 5;
int max = 10;
rnd = new Random();
r = min + rnd.nextInt(max - min);
print("$r is in the range of $min and $max");