gpt4 book ai didi

ios - 如何使用相同的新索引对每个数组进行洗牌?

转载 作者:可可西里 更新时间:2023-11-01 02:18:18 26 4
gpt4 key购买 nike

<分区>

我有一个书名数组,另一个有相应的书名作者。让我们假设我需要它们在不同的数组中,而不是在同一个字典中。如何重新排序两个数组的索引,同时确保数组 2 的索引仍然对应于数组 1 的索引?

//This is what I currently have:
var arrayOne = ["one", "two", "three", "four"]
var arrayTwo = [1, 2, 3, 4]

//The new indexes should be random, non-repeating integers
arrayOne = ["four", "two", "three", "one"]
arrayTwo = [4, 2, 3, 1]

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com