# F.Y.I. node-red-contrib-random-item removes items from the array it selects from

**URL:** <https://discourse.nodered.org/t/f-y-i-node-red-contrib-random-item-removes-items-from-the-array-it-selects-from/34207>\
**Category:** General\
**Created:** [13 October 2020 23:11 UTC](https://discourse.nodered.org/t/f-y-i-node-red-contrib-random-item-removes-items-from-the-array-it-selects-from/34207 "2020-10-13T23:11:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [13 October 2020 23:11 UTC](https://discourse.nodered.org/t/f-y-i-node-red-contrib-random-item-removes-items-from-the-array-it-selects-from/34207/1 "2020-10-13T23:11:17Z")

</div>

I've opened an issue about this on GitHub ([https://github.com/zachowj/node-red-contrib-random-item/issues/6](https://github.com/zachowj/node-red-contrib-random-item/issues/6)) but I thought I'd mention it here incase someone ever uses the node and runs into this issue.

The documentation in the node says "A node that selects a random item from an array." What it doesn't say is that it actually removes the item from the array. In the following image you can see the `inject` node created an array with 6 items and after the `random-item` node runs, the array only has 5 items.

 ![Screen Shot 2020-10-13 at 7.02.32 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/a/baa13c35eb33b51d355bfa58351d4cfd688d8579.png)

Feed the msg thru a `delay` and back to the `random-item` node and it will result in the node stopping with a '"Input is an empty array"' message showing in the node status and in the debug sidebar and log.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 December 2020 23:11 UTC](https://discourse.nodered.org/t/f-y-i-node-red-contrib-random-item-removes-items-from-the-array-it-selects-from/34207/2 "2020-12-12T23:11:25Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
