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

I've opened an issue about this on GitHub (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.

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.

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