Swift Random | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Swift Random

I am trying to generate some random elements from an char array and a string using random() function and Int(arc4random_uniform(UInt32())) I get sintax error: error: value of type '[String]' has no member 'random' error: use of unresolved identifier 'arc4random_uniform' I tried to import Foundation and I get: Swift Output <module-includes>:1:10: note: in file included from <module-includes>:1: #include "CoreFoundation.h" ^ ..\Playground\/CoreFoundation.h:25:10: error: 'assert.h' file not found #include <assert.h> ^ <unknown>:0: error: could not build C module 'CoreFoundation' <module-includes>:1:10: note: in file included from <module-includes>:1: #include "../../....\Playground\-w64-mingw32/include/assert.h" ^ I have tried different libraries and it doesn't recognised anyone. I don't understand which is the problem. Thank you!

21st Jan 2019, 9:45 AM
Alexandra Meciu
Alexandra Meciu - avatar
1 Answer
- 3
Compiler is answer here. Code C but you had used Swift compiler.
21st Jan 2019, 1:30 PM
Ümit YAVUZ - avatar