Basic usage

Given an array of items, return a new array with the items in a random order.

import { shuffle } from 'radash'

const fish = [{
  name: 'Marlin',
  weight: 105,
  source: 'ocean'
}, {
  name: 'Salmon',
  weight: 22,
  source: 'river'
}, {
  name: 'Salmon',
  weight: 22,
  source: 'river'
}]

shuffle(fish)

Note, this is not a cutting edge performance optimized function. This function is optimized for simplicity and best used as a utility. If performance is a priority for you, use a randomness and/or shuffle library.

Testing

This _.shuffle function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.shuffle on GitHub.