Apple Game Frameworks and Technologies: why build SKRange and then use lowerLimit and UppoerLimit?

Title: Name of Apple Game Frameworks and Technologies: why build SKRange and then use lowerLimit and UppoerLimit? (“Fixing the Drop Pattern”

I see the following pattern a couple of times,

let randomModifier = SKRange(lowerLimit: 50 + CGFloat(level), upperLimit: 60 * CGFloat(level))
let modifier = CGFloat.random(in: randomModifier.lowerLimit ... randomModifier.upperLimit)

Is there a reason to build an SKRange and then use it’s (lower|upper)Limit to create a rang for random() ??

I.e. why not this:

 let modifier = CGFloat.random(in: 50 + CGFloat(level) ... 60 * CGFloat(level))

(which seems to work fine for me?)

The same thing was done for the dropRange and generation of randomX, but it snuck past me the first time.

1 Like