5

I want to generate a random number in Swift within a function deployed to OpenWhisk on IBM Bluemix.

Because it's a Linux runtime, I can't use arc4random_uniform(). I also don't want to use drand48() because it doesn't give me a truly random number (psuedo-random sequence).

Still, so far I've tried...

let answer = drand48() * 10000

...which yields 3.90798504668055e-10

Any ideas?

dokun1
  • 2,120
  • 19
  • 37
  • rand() should do it take a look at the following example https://github.com/SwiftOnTheServer/DrinkChooser/blob/master/actions/_common.swift#L8 – csantanapr Feb 27 '17 at 23:05

0 Answers0