当前位置:网站首页>flutter dart生成N个区间范围内不重复随机数List
flutter dart生成N个区间范围内不重复随机数List
2022-07-26 10:39:00 【Flutter萌新学院】
List<int> resultList = [];
var rng = new Random();
int count = 0;
while (count < 6) {
//生成6个
int index = rng.nextInt(12) + 1; // 1-12之间区间
if (!resultList.contains(index)) {
resultList.add(index);
count++;
}
}
resultList.sort();
print(resultList);
边栏推荐
- 比较器(Comparable与Comparator接口)
- 多目标优化系列1---NSGA2的非支配排序函数的讲解
- MySQL速学-2021-09-01
- 构建ARM嵌入式开发环境
- 在神州IV开发板上为STemWin 5.22加入触屏驱动
- .NET操作Redis Set无序集合
- Introduction to data analysis | kaggle Titanic mission (I) - > data loading and preliminary observation
- oracle 启动不了 tnslistener服务启动不了
- .net operation redis set unordered collection
- 剑指Offer(二十):包含min函数的栈
猜你喜欢
[leetcode daily question 2021/5/8]1723. The shortest time to complete all work
[leetcode daily question 2021/2/14]765. Lovers hold hands
Issue 6: which mainstream programming language should college students choose
第7期:内卷和躺平,你怎么选
[leetcode每日一题2021/2/13]448. 找到所有数组中消失的数字
【机器学习小记】【人脸识别】deeplearning.ai course4 4th week programming
.NET 开源框架在工业生产中的应用
【dectectron2】跟着官方demo一起做
英语基础句型结构------起源
Tradingview tutorial
随机推荐
Introduction to data analysis | kaggle Titanic mission (I) - > data loading and preliminary observation
比较器(Comparable与Comparator接口)
Flutter 防止科学计数并去除尾数无效0
Introduction to Phoenix (Level 1: Phoenix installation, level 2: Phoenix basic grammar)
Uniapp uses the simple method signalr (only for web debugging, cannot package apps)
RT-Thread 学习笔记(八)---开启基于SPI Flash的elmfat文件系统(下)
json_ object_ put: Assertion `jso->_ ref_ count > 0‘ failed. Aborted (core dumped)
Asynctask < T> decoration and await are not used in synchronous methods to obtain asynchronous return values (asynchronous methods are called in synchronous methods)
C language calculation date interval days
router.push(),router.repalce(),router.go()使用
11 在 operator= 中处理“自我赋值”
使用grid实现左中右布局,中间内容自适应
oracle 启动不了 tnslistener服务启动不了
Centos8 (liunx) deploying WTM (asp.net 5) using PgSQL
剑指Offer(五十二):正则化表达式
反射机制简述
抽象工厂及其改进示例
[leetcode daily question 2021/4/23]368. Maximum divisible subset
datav漂亮数据屏制作体验
algorithm