Cannot call the randomized data in Swift

I was able to sort out getting my data randomized and passed to a different view controller in this Collect-Randomize the data post.

But I still got one problem that I couldn't overcome. I have my data constructed with a struct and array which you can see below:

 Struct Character {
    var character: String
    var characterImageString: String
    var characterDetail: String

var characterArray = [Character(character: "Zoolog Xander", characterImageString: "characterImageString", characterDetail: "some detail here."),

I can get the data randomized and show on the viewController with the code below. But problem is that character, characterDetail and characterImage must have the associated data. But in this case, they all get randomized independently.

characterName.text = randomCharacter().character
characterDetailTextTrial.text = randomCharacter().characterDetail
characterImageView.image = randomCharacter().characterImage

So the array is this:

var characterArray = [ Character(character: "Zoolog Xander", characterImage: UIImage(named:"Zoolog Xander")!, characterDetail: "Knows animals well, runs like a horse, eats a hamburger in 10 seconds and smells like a cow")]

When I touch on the shuffle button, the view should show the data in the array with all other associated info but at the moment, it gets some other data from the same characterArray. So imageView doesn't match with the characterName or even the detail.

These are the functions that I use to randomize the data:

func randomCharacter() -> Character {

            let randomNumber = GKRandomSource.sharedRandom().nextInt(upperBound: characterArray.count)

            return characterArray[randomNumber]


        func randomPlaces() -> Place {

            let randomNumberOne = GKRandomSource.sharedRandom().nextInt(upperBound: placeArray.count)

            return placeArray[randomNumberOne]

        func randomProblems() -> Problem {

            let randomNumberTwo = GKRandomSource.sharedRandom().nextInt(upperBound: problemArray.count)

            return problemArray[randomNumberTwo]


        func randomTime() -> Time {

            let randomNumberThree = GKRandomSource.sharedRandom().nextInt(upperBound: timeArray.count)

            return timeArray[randomNumberThree]

characterArray.randomElement() worked fine in the console so when shuffle it, print console shows me random Character with the details but I still couldn't figure out how to get those show up on the viewController. This is the code where I used to show on the view;

override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
            if(event?.subtype == UIEvent.EventSubtype.motionShake) {


                /*characterName.text = randomCharacter().character
                characterDetailTextTrial.text = randomCharacter().characterDetail
                characterImageView.image = randomCharacter().characterImage

} }

The code below shows the data on view but they are still not associated with each other:

    characterName.text = characterArray.randomElement()?.character
    characterDetailTextTrial.text =
    characterImageView.image = characterArray.randomElement()?.characterImage

I was able to solve the problem with the help of the code below:

if let randomProblem = problemArray.randomElement() {
                problemName.text = randomProblem.problem
                problemDetailTextTrial.text = randomProblem.problemDetail