How do I do random numbers in swift in repl.it?
Hi Shades! Thanks for using replit! I don't know Swift or Objective-C, but you should be able to generate random numbers in repl.it the same way you would generate random numbers in any other environment. This might help: https://stackoverflow.com/questions/32552336/generating-random-numbers-with-swift
@Tim Chen: Unfortunately it doesn't work. I tried this https://repl.it/@Shades/AbsoluteVirtualJunebug
@Shades: Thanks for the example, this helps a lot. From initial searches it looks as though some dependencies are missing from replit or some permissions are not properly set. We'll see what we can do!
@Tim Chen: https://bugs.swift.org/browse/SR-3648 Looks like you can set some variables maybe.
Do we know if this will be possible in the repl environment? This is an aspect of the Apple Swift curriculum.
Swift 4.2 included cleaner solution to generate a random integer. This works without Foundation or any other imported frameworks.
let randomNumber = Int.random(in: 0...4)
@GarrisonReid: Thanks! We're on 4.2 now so this should work. :)