summaryrefslogtreecommitdiff
path: root/docs/src/components/Examples/Functions/random-index.js
blob: a55487da5710d50b7d6c78a9bea5630e2c07759d (plain) (blame)
1
2
3
4
5
6
7
8
9
/**
 * Random Index from Array
 * @param {Number} length - Length of Array
 * @returns Random Index from the Array
 */

const randomIndex = (length) => Math.round(Math.random() * (0-length)) + length - 1

export default randomIndex