# Generate a random array of entire numbers using a range

**URL:** https://community.glideapps.com/t/generate-a-random-array-of-entire-numbers-using-a-range/44028
**Category:** Ask for Help
**Created:** [July 7, 2022, 6:37am UTC](https://community.glideapps.com/t/generate-a-random-array-of-entire-numbers-using-a-range/44028 "2022-07-07T06:37:57Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [July 7, 2022, 8:27am UTC](https://community.glideapps.com/t/generate-a-random-array-of-entire-numbers-using-a-range/44028/4 "2022-07-07T08:27:24Z")

</div>

![Screen Shot 2022-07-07 at 4.24.57 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/d/fd8dec8b07d8ebef423ce957a34e627e77aee8cc.png)

```auto
var arr = [];
while (arr.length < 6) {
  var r = Math.floor(Math.random() * 100) + 1;
  if (arr.indexOf(r) === -1) {
    arr.push(r);
  }
}
return arr.join(',');

```

One thing to note is that you can’t pass or return arrays to/from the JavaScript column. So it has to be returned as a string. But that can be coerced into an array by using a Split Text column if that’s what you actually need.

---

_[View the full topic](https://community.glideapps.com/t/generate-a-random-array-of-entire-numbers-using-a-range/44028)._
