0

I'm using earlier version of xcode (8.2.1) , I didnt succeed to update xcode from the app store.

any way it doesnt allow me to do randomize me arras elements ( which are cube picture for a roll dice app )

diceImageView.image  = [photo1...to..photo6 [Int.random(in: 0...5)]

the .random after Int just doesn't exist. I dont know what an alternative to use most of the stuff i've seached for they are more advanced or dont work\dont understand it, also tried arc4random_uniform unit32 and shuffle and such but it doesn't work.

can someone explain me how to randomize it?

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
Alex
  • 11

1 Answers1

1

Once you update Xcode you can just use the shuffle method like so array.shuffle(). The shuffle() method randomly reorders the elements of an array by passing in the system's default random generator and is O(n) complexity. I posted a screenshot below. enter image description here

Newbie
  • 164
  • 7