Swift generates random number without arc4random

I want to create a random number in Swift as part of a function deployed to OpenWhisk on IBM Bluemix.

Since this is a Linux runtime, I cannot use arc4random_uniform() . I also do not want to use drand48() because it does not give me a really random number (psuedo-random sequence).

However, I tried ...

 let answer = drand48() * 10000 

... which gives 3.90798504668055e-10

Any ideas?

+5
source share

Source: https://habr.com/ru/post/1264808/


All Articles