Question: *I am new to StackOverflow so please correct me if there is a better way to post a question which is a specific case of an existing question.*

Alberto Barrera answered 
[How does one seed the random number generator in Swift?](https://stackoverflow.com/questions/25895081/how-does-one-seed-the-random-number-generator-in-swift)

with 

```
let time = UInt32(NSDate().timeIntervalSinceReferenceDate)
srand(time)
print("Random number: \(rand()%10)")

```

which is perfect generally, but when I try it in [The IBM Swift Sandbox](http://swiftlang.ng.bluemix.net/#/repl) it gives the same number sequence every run, at least in the space of a half hour.

```
import Foundation
import CoreFoundation

let time = UInt32(NSDate().timeIntervalSinceReferenceDate)
srand(time)
print("Random number: \(rand()%10)")

```

At the moment, every Run prints 5.

Has anyone found a way to do this in the IBM Sandbox? I have found that random() and srandom() produce a different number sequence but similarly are the same each Run. I haven't found arc4random() in Foundation, CoreFoundation, Darwin, or Glibc.

*As an aside, I humbly suggest someone with reputation above 1500 creates a tag IBM-Swift-Sandbox.*

Answer: 
This was an issue with the way we implemented server-side caching in the Sandbox; non-deterministic code would continually return the same answer even though it should not have. We've disabled it for now, and you should be getting different results with each run. We're currently working on better mechanisms to ensure the scalability of the Sandbox.

I'll see about that tag, as well!
I don't know what is going on but today it is totally working. So I guess the question is answered: 

```
srand(UInt32(NSDate().timeIntervalSinceReferenceDate))

```

works fine.

(I think something must have changed. It was behaving the same way (generating the same number with repeated attempts) on two different computers for about 10 days... Bizarre.)