Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5
Code Playground Swift appears to run on Swift 4 (4.0), so the second wouldn't work. As for arc4random, it seems that the Foundation library is required. Importing the library, however, sparks this: https://bugs.swift.org/browse/SR-3648 I then tried to build my own RNG with system date/time, but that seems to require Foundation too! (Date(), NSDate()) *** 1 hour later *** My final attempt. Dynamic memory allocation - fairly random. print(UnsafeMutablePointer<Int>.allocate(capacity:1)) https://code.sololearn.com/cjZ97ZgStq68/
31st Oct 2018, 12:30 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
Jeffrey Asante As it is currently, the result is a string representation. Converting it to an Int should not be an issue (I think).
31st Oct 2018, 5:00 PM
Hatsy Rei
Hatsy Rei - avatar