diff options
Diffstat (limited to 'docs/src/components/Examples/Functions/random-index.js')
-rw-r--r-- | docs/src/components/Examples/Functions/random-index.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/src/components/Examples/Functions/random-index.js b/docs/src/components/Examples/Functions/random-index.js new file mode 100644 index 000000000..a55487da5 --- /dev/null +++ b/docs/src/components/Examples/Functions/random-index.js @@ -0,0 +1,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
\ No newline at end of file |