# Random node - add ability to pass in the 'From' and 'To' options

**URL:** <https://discourse.nodered.org/t/random-node-add-ability-to-pass-in-the-from-and-to-options/34164>\
**Category:** Core Development\
**Created:** [13 October 2020 08:34 UTC](https://discourse.nodered.org/t/random-node-add-ability-to-pass-in-the-from-and-to-options/34164 "2020-10-13T08:34:33Z")\
**Posts on this page:** 4\
**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 08:34 UTC](https://discourse.nodered.org/t/random-node-add-ability-to-pass-in-the-from-and-to-options/34164/1 "2020-10-13T08:34:34Z")

</div>

I have a case where I'm reading a folder and storing the list of files in an array. I'd like to pick a random file from that list.

It would be nice if the `random` node had the ability to accept 'From' and 'To' from the incoming message. In my case I'd be able to pass in the number of items in the array (instead of coding a function) to get a random number for the array.

Does this seem like a reasonable addition to the node and would a PR to add this functionality be welcome?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [13 October 2020 09:00 UTC](https://discourse.nodered.org/t/random-node-add-ability-to-pass-in-the-from-and-to-options/34164/2 "2020-10-13T09:00:29Z")

</div>

Yes I can’t see a problem, as long as it’s in the usual style of the config option should be left blank to allow the msg option, and it tests that it is numeric etc. And suitable tests are added.

---

<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 09:19 UTC](https://discourse.nodered.org/t/random-node-add-ability-to-pass-in-the-from-and-to-options/34164/3 "2020-10-13T09:19:15Z")

</div>

Great, I'll work on it in the next few days

---

<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 09:19 UTC](https://discourse.nodered.org/t/random-node-add-ability-to-pass-in-the-from-and-to-options/34164/4 "2020-12-12T09:19:21Z")

</div>

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