Protocol

GKRandom

The common interface for all randomization classes in (or usable with) GameplayKit.

Overview

GameplayKit randomization classes include the GKRandomSource and GKRandomDistribution classes and their subclasses. You use those classes to generate random behavior for gameplay mechanics, and use this protocol type directly when composing random sources to create more complex randomizers.

For more information on choosing and using randomizers in GameplayKit, read Randomization in GameplayKit Programming Guide.

Symbols

Generating Random Numbers

func nextInt()

Generates and returns a new random integer.

func nextInt(upperBound: Int)

Generates and returns a new random integer less than the specified limit.

func nextUniform()

Generates and returns a new random floating-point value.

func nextBool()

Generates and returns a new random Boolean value.

Relationships