refactor: 使用洗牌算法来确保随机性

This commit is contained in:
AnnAngela
2023-06-15 17:28:19 +08:00
committed by GitHub
parent 8116161dbb
commit 78e6d138dd

View File

@@ -7,7 +7,15 @@ _注 2以下模拟器排序为随机生成排名不分先后_
import MarkdownIt from 'markdown-it'
import MarkdownItAnchor from 'markdown-it-anchor'
const fullySupport = [
const shuffleArray = (array) => {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
const fullySupport = shuffleArray([
`
### ✅ [蓝叠模拟器 5](https://www.bluestacks.cn/)
完美支持。需要在模拟器 \`设置\` - \`引擎设置\` 中打开 \`允许ADB连接\`
@@ -49,9 +57,9 @@ const fullySupport = [
- “完成后退出模拟器”功能可能偶现异常,如果遇到请向 MuMu 官方反馈;
- 多开时需通过 MuMu 12 多开器的 ADB 按钮,查看对应实例的端口信息,将 MAA 设置-连接设置 的连接地址的端口号修改为对应的端口。
`,
].sort((a, b) => 0.5 - Math.random())
])
const particallySupport = [
const particallySupport = shuffleArray([
`
### ⚠️ [MuMu 模拟器 6](https://mumu.163.com/)
@@ -83,9 +91,9 @@ const particallySupport = [
- 任务运行过程中请尽量保证明日方舟在前台且无其他安卓应用同时在前台运行,否则可能导致游戏暂停运行或任务识别错误。
- WSA 的截图经常莫名其妙截出来一个白屏,导致识别异常,还是不推荐使用。
`,
].sort((a, b) => 0.5 - Math.random())
])
const notSupport = [
const notSupport = shuffleArray([
`
### 🚫 MuMu 手游助手(星云引擎)
@@ -96,7 +104,7 @@ const notSupport = [
不支持,未开放 adb 端口。
`,
].sort((a, b) => 0.5 - Math.random())
])
const md = (new MarkdownIt()).use(MarkdownItAnchor, { permalink: true, permalinkBefore: true, permalinkSymbol: '#' })