# How to load images using an arrayList?

**URL:** <https://discourse.processing.org/t/how-to-load-images-using-an-arraylist/15263>\
**Category:** Beginners\
**Created:** [November 5, 2019, 7:34pm UTC](https://discourse.processing.org/t/how-to-load-images-using-an-arraylist/15263 "2019-11-05T19:34:30Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 5, 2019, 9:04pm UTC](https://discourse.processing.org/t/how-to-load-images-using-an-arraylist/15263/3 "2019-11-05T21:04:42Z")

</div>

> [@B\_s](#):
>
> I only understand how I could use an ArrayList to solve this with a list of numbers.

Use the 2nd **shuffle()** version from the link below: 👼

> [@Repeating and randomizing string arrays](https://discourse.processing.org/t/repeating-and-randomizing-string-arrays/10811/6):
>
> The shuffle() function from the 1st link I’ve posted is for arrays of datatype int only: @SafeVarargs final int[] shuffle(final int... arr) { if (arr == null) return null; int idx = arr.length; while (idx \> 1) { final int rnd = (int) random(idx--), tmp = arr[idx]; arr[idx] = arr[rnd]; arr[rnd] = tmp; } return arr; } For object-typed arrays, we need to convert it, like this: @SafeVarargs final \<T\> T[] shuffle(final T... arr) { if (arr == null) return null; …

It can shuffle any non-primitive array. 😉

---

_[View the full topic](https://discourse.processing.org/t/how-to-load-images-using-an-arraylist/15263)._
