Flutter - How To Generate Random Numbers (With Different Ranges)

Published: 08 July 2021
on channel: Flutter Mentor
4,899
69

What is up? In this video, you can quickly figure out how to generate numbers on Flutter with whatever range you prefer.

It's very straightforward.

Just import "dart:math" and then use the Random() class to access the nextInt function. All you have to do is provide that function with the max number you want to randomize to! But the number itself is non-inclusive.

So, just watch the video to make sure you understand the explanation, thanks!

00:00 - Intro
00:35 - Importing dart:math
00:45 - Randomizing From 0-100
01:35 - Randomizing From 0-10
01:55 - Randomizing From 1-10
02:28 - Randomizing From 5-10
02:57 - Randomizing From 50-100
03:30 - Like & Subscribe
03:40 - Flutter Mentor Out

#flutter #randomnumber #generate

Credits:

OUTRO SONG:
Mitsubachi by Smith The Mister https://smiththemister.bandcamp.com
Smith The Mister https://bit.ly/Smith-The-Mister-YT
Free Download / Stream: http://bit.ly/mitsubachi
Music promoted by Audio Library    • Mitsubachi – Smith The Mister (No Cop...