当前位置:网站首页>TypeScript数组乱序输出
TypeScript数组乱序输出
2022-07-02 12:46:00 【RemoteDev】
1. 目标数组 : let ak = [1,2,3,4,5];
2. 目标效果 : 随机乱序

3. 实现思路: 循环随机取数组一个元素,使用后,从数组删除该元素,随机范围为数组长度
while(ak.length>0){
let i = randomRangeInt(0,ak.length);
console.log(ak[i]);
ak.splice(i,1);//删除已使用项
}
边栏推荐
- Vscode设置标签页多行显示
- 处理gzip: stdin: not in gzip formattar: Child returned status 1tar: Error is not recoverable: exitin
- Boot 事务使用
- [Xiaobai chat cloud] suggestions on container transformation of small and medium-sized enterprises
- SQL modification statement
- Processing gzip: stdin: not in gzip format: child returned status 1tar: error is not recoverable: exitin
- 请问怎么在oracle视图中使用stustr函数
- Data Lake (11): Iceberg table data organization and query
- Effectively use keywords to increase Amazon sales
- 中科大脑知识图谱平台建设及业务实践
猜你喜欢

Application of visualization technology in Nebula graph

Storage, reading and writing of blood relationship data of Nepal Graph & Data Warehouse
![[Yu Yue education] reference materials of sensing and intelligent control technology of Nanjing University of Technology](/img/5c/5f835c286548907f3f09ecb66b2068.jpg)
[Yu Yue education] reference materials of sensing and intelligent control technology of Nanjing University of Technology

Summary of multithreading and thread synchronization knowledge

Huawei ECS installs mysqlb for mysqld service failed because the control process exited with error code. See “sys

中科大脑知识图谱平台建设及业务实践

Compress words (kmp/ string hash, double hash)

2022 the latest and most detailed will successfully set the background image in vscade and solve unsupported problems at the same time

Introduction to dynamic planning I, BFS of queue (70.121.279.200)

dried food! Understand the structural vulnerability of graph convolution networks
随机推荐
Introduction to Dynamic Planning II (5.647.62)
仙人掌之歌——投石问路(3)
Register as a harmonios developer and install deveco studio 3.0 beta2 for harmonios
Experiment collection of University "Fundamentals of circuit analysis". Experiment 4 - Research on linear circuit characteristics
After the win10 system is upgraded for a period of time, the memory occupation is too high
AWS云主机扩容
win10系统升级一段时间后,内存占用过高
Comprehensively interpret the background and concept of service mesh
beforeEach
原神2.6服务端下载以及搭建安装教程
Introduction to database system Chapter 1 short answer questions - how was the final exam?
纪念成为首个 DAYU200 三方 demo 贡献者
dried food! Understand the structural vulnerability of graph convolution networks
Group by的用法
Memory alignment of structure
(Wanzi essence knowledge summary) basic knowledge of shell script programming
SQL modification statement
处理gzip: stdin: not in gzip formattar: Child returned status 1tar: Error is not recoverable: exitin
Use ffmpeg command line to push UDP and RTP streams (H264 and TS), and ffplay receives
又是一年毕业季