var par = [[Double]]()
par.append(Array(stride(from: -1, through: 10, by: 1.0)))
//par[0] == [-1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
par.append(Array(stride(from: -10, through: 1, by: 1.0)))
//par[1] == [-10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0]
//there could be more much more arrays in par…
//Total combinations, 144 in this case
var c: Int = 0
c = par[0].count
for i in 1 ..< par.count {
c *= par[i].count
}
for i in 0 ..< c {
//?
}
嗨!问题是用par [0],par [1],......制作数组的最简单方法是什么?在这种情况下12x12:[ - 1.0,-10.0],[ - 1.0,-9.0],...,[10.0,1.0],但它可能是2x20,2x10x50,10x10x20x20 ......