Hi.
I have a problem. When I try to generate random numbers from 1 to 4 to an array I get a fatal error "Thread 1: Fatal error: Index out of range" and everything crashes.
Here is my code:
import Foundation
let maxLevel:Int = 99
var randomSeq: [Int] = []
struct NumGen{
static func Generate() - Void {
for i in 1...maxLevel{
randomSeq[i] = Int.random(in: 1...4)
print(i)
}
}
}
BTW I am using m1 mac mini if that makes a difirence.
Plese help. Thanks
Selecting any option will automatically load the page