I have been trying to play with GameplayKit's GKLinearCongruentialRandomSource function with a playground and I can't seem to get anything useful out of it. I am new to Swift for sure, so it is most-likely a bonehead error. :-) However I couldent find an example online and the docs don't really show (at least to me) any functional code examples.
Here is what I have in a playground:
//: testing out new GameplayKit (GK) Congruential Random Source
import UIKit
import GameplayKit
let seed: UInt64 = 987234904
let random = GKLinearCongruentialRandomSource(seed: seed)
let result = random.nextIntWithUpperBound(10) // should be a random Int from 0 to 9 (total 10 possibilities
Normally playground will give me the 'values' as I assign / use them. However for this example it did not. If I comment out the 'let random' and 'let result' lines, then playground shows the seed was registed by showing me it's value on the right-side. That makes me think the on-the-fly compiler is choking on the 'let random' statement.
The funny thing is Playground is not kicking out any syntax errors.
So what silly thing am I doing wrong? Can somebody give me a quick sample on how to actually use this cool new feature?