Want to generate random numbers in Dart? Use Random class from dart:math:
1 2 3 4 5 6 7 8 | import 'dart:math'; main() { var rng = new Random(); for (var i = 0; i < 10; i++) { print(rng.nextInt(100)); } } |
This code was tested with the Dart VM and dart2js, as of the time of this writing.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.