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!
`srand` is working as expected. If you change value each time in `let time = UInt32(NSDate().timeIntervalSinceReferenceDate)` instead of `NSDate().timeIntervalSinceReferenceDate` with any number, it will output random numbers.

Maybe this is a caching issue, it just doesn't see any changes in code and doesn't send it for recompilation :)