Random

Introduction

Random operation of an array, built-in methods of phaser.

  • Author: Richard Davey

Usage

Get random item

var item = Phaser.Utils.Array.GetRandom(arr);
// var item = Phaser.Utils.Array.GetRandom(arr, startIndex, length);

Remove random item

var item = Phaser.Utils.Array.RemoveRandomElement(arr);

Shuffle

var arr = Phaser.Utils.Array.Shuffle(arr);