How to get index in an array from an random rotation degrees?

Hi guys, I'm new to SwiftUI and I'm still working on my spinning wheel. For now I wanna show people the results on screen by Text("(Array[index])"). the question is i know the random rotation degrees but i don't know how to transfer it to that "result angles" index :P ,Any help I will appreciate it ! I use Path to draw the wheel:

var slices: Array<OneChance.OneChanceData> {

        let sum = Double(newChoices.count)

        var endDeg: Double = 0.0

        var tempSlices: [OneChance.OneChanceData] = []

        for (color, text) in zip(colors, newChoices) {

            let degrees: Double = Double(360 / sum)

            

            tempSlices.append(OneChance.OneChanceData(startAngle: Angle(degrees: endDeg), endAngle: Angle(degrees: endDeg + degrees), text: text, color: color))

            endDeg += degrees

        }

        return tempSlices

    }

The spinning wheel view:

ForEach(0..<chanceVM.newChoices.count) { i in

                        EachSliceView(chanceData: self.chanceVM.slices[i])

                    }

I use onTapGesture to get random wheel spinning degrees:

.onTapGesture {

                            self.chanceVM.showResult = false

                            self.chanceVM.rotateDegree = 0.0

                            playSound(sound: "wheelSpinning13s", type: "mp3")

                            self.chanceVM.allowToTapAgain = false

                            withAnimation(Animation.easeOut(duration: 13.0)) {

                                self.chanceVM.rotateDegree = Double.random(in: 5400.0...7200.0)

                            }

                            print("\(chanceVM.rotateDegree)")

                            print("\((Int(chanceVM.rotateDegree) % 360))")

                            print("\((Int(chanceVM.rotateDegree) % 360)/(360/chanceVM.newChoices.count))")

                            self.chanceVM.delayText()

                            self.chanceVM.delayTap()

                        }

So how can i get the index after random spinning degrees?

I think i figured it out, i use : Text(chanceVM.newChoices[chanceVM.newChoices.count - (Int(chanceVM.rotateDegree) % 360)/(360/chanceVM.newChoices.count) - 1]) I don't know why i just use mius 1 then i get the result

How to get index in an array from an random rotation degrees?
 
 
Q