Arrays.sample()

Randomly select one item from an array.

Usage

Hover over inputs/exits for more info.

var Arrays = require('machinepack-arrays');


// Randomly select one item from an array.

Arrays.sample({

array: [ '*' ],

}).execSync();

Inputs

array required

The array of items to pick from.

[ '*' ]

Exits

error

An unexpected error occurred.

emptyArray

The provided array has no items.

success

OK.

(varies based on provided inputs)