# Picking a Random Item from an Array

**URL:** <https://forum.kirupa.com/t/picking-a-random-item-from-an-array/399178>\
**Category:** programming\
**Created:** [December 2, 2014, 12:27am UTC](https://forum.kirupa.com/t/picking-a-random-item-from-an-array/399178 "2014-12-02T00:27:34Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [December 16, 2020, 6:57pm UTC](https://forum.kirupa.com/t/picking-a-random-item-from-an-array/399178/11 "2020-12-16T18:57:47Z")

</div>

I’m sure @senocular or @krilnon will have a much better solution, but what I do is just shuffle the array first and then pick all the items in sequence. This ensures no items is picked up more than once.

This article can help:

> **[Shuffling an Array](https://www.kirupa.com/html5/shuffling_array_js.htm)**
>
> Use the Fisher-Yates / Knuth approach to quickly shuffle the contents of an array in JavaScript.

🙂

---

_[View the full topic](https://forum.kirupa.com/t/picking-a-random-item-from-an-array/399178)._
