Phaser API Documentation

  Version: 
getRandom([startIndex], [length])

Description:

Returns a random Game Object from this Container.

Parameters:

name type arguments description
startIndex number <optional>

An optional start index.

length number <optional>

An optional length, the total number of elements (from the startIndex) to choose from.

Returns:
Description:

A random child from the Container, or null if the Container is empty.

Since: 3.4.0