I am trying to generate a random 6 bytes long hex but I ma having problems. the error I am getting is: "Integer literal overflows when stored into 'UInt32'".
Here is my code:
var baseInt = UInt64(arc4random() % 281474976710655)
var str = String(format: "%06X", baseInt)
println("\(str)")
Any help?
Following @Amadan suggestion I got it working.
var baseIntA = Int(arc4random() % 65535)
var baseIntB = Int(arc4random() % 65535)
var str = String(format: "%06X%06X", baseIntA, baseIntB)
println("\(str)")
Then it outputs: "009DD7004974
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With