Phaser API Documentation

  Version: 

Member of: Phaser.Utils.Array

<static> GetRandom(array, [startIndex], [length])

Description:

Returns a Random element from the array.

Parameters:

name type arguments Default description
array array

The array to select the random entry from.

startIndex number <optional> 0

An optional start index.

length number <optional> array.length

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

Returns:
Description:

A random element from the array, or null if no element could be found in the range given.

Type:
  • *
Since: 3.0.0