Is there a better way to get random data from firestore for both users in the game room simultaneously? What I did is that I created a number array according to the number of questions on the server (therefore, I have to change it every time that I add new question).
func retriveQuestions() {
    let idRef = db.collection("ROOMS_Collection").document(GameData.shared.documentID)
    idRef.getDocument { (docSnapshot, error) in
        guard let docSnapshot = docSnapshot, docSnapshot.exists else {return}
        let data = docSnapshot.data()
        self.questionIDs = (docSnapshot.data()?.compactMap({_ in QuestionID(dictionary: data!)}))!
        let id = self.questionIDs[0]
        let questionRef = self.db.collection("QUESTIONS_Collection").document("\(id.questionID[self.arrayNum])")
        questionRef.getDocument{ (docSnapshot, error) in
            guard let docSnapshot = docSnapshot, docSnapshot.exists else { return }
            let data = docSnapshot.data()
            self.questionArray = (docSnapshot.data()?.compactMap({_ in Question(dictionary: data!)}))!
            let question = self.questionArray[0]
            self.answer = Int(question.answer)!
            self.questionText.fontColor = UIColor.white
            self.questionText.fontName = "Verdana"
            self.questionText.text = ("\(question.question)")
            self.questionText.fontSize = 24.0
            self.questionText.numberOfLines = 0
            self.questionText.lineBreakMode = NSLineBreakMode.byWordWrapping
            self.questionText.zPosition = 5
            self.questionText.position = CGPoint(x: (self.questionBackground?.frame.midX)! - 5, y: (self.questionBackground?.frame.midY)! - 5)
            self.questionText.preferredMaxLayoutWidth = (self.questionBackground?.frame.width)! - 10
            self.addChild(self.questionText)
        }
    }
}
 
    