My task was to create a multidimensional Array with random elements in each row and column. In result, I got a multidimensional Array which I have identical rows in. The function randomizer does not seem to be working as I expected.
Since randomNum is global state that outlives the body of randomizer for every call after the first one randomNum is already full.
Said another way, the first call to randomizer fills randomNum with length values and nothing ever clears it out so every subsequent call immediately skips over the while loop and returns the same array.
Instead of relying on shared mutable state try creating a function that takes in a length and returns an array of random Ints.
func makeRandomInts(length: Int) -> [Int] {
// Implementation that does not access global state
}