# Repeating and randomizing string arrays

**URL:** <https://discourse.processing.org/t/repeating-and-randomizing-string-arrays/10811>\
**Category:** Libraries\
**Created:** [May 1, 2019, 3:12pm UTC](https://discourse.processing.org/t/repeating-and-randomizing-string-arrays/10811 "2019-05-01T15:12:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 1, 2019, 3:47pm UTC](https://discourse.processing.org/t/repeating-and-randomizing-string-arrays/10811/2 "2019-05-01T15:47:56Z")

</div>

> [@Questions about my Color Array](https://discourse.processing.org/t/questions-about-my-color-array/3110/5):
>
> I didn’t bother warning about that b/c the colors[] array already had 3 elements in it. relieved BtW, here’s an even shorter version w/ just while () instead of do // while (): smirk_cat void pick() { int newIndex; while ((newIndex = (int) random(colors.length)) == index); index = newIndex; } Nonetheless, a custom shuffle() approach (from my previous posted link) is much more commendable: grin @ SafeVarargs final int[] shuffle(final int... arr) { if (arr == null) return null;…

> [@Color Shuffle with hex color codes](https://discourse.processing.org/t/color-shuffle-with-hex-color-codes/1191/11):
>
> The better & more performant way is to rely on IntList instead, as I had already linked to at my 1st reply: wink[https://Processing.org/reference/IntList.html](https://Processing.org/reference/IntList.html) You’ll have access to better methods, such as shuffle() & array(): muscle[https://Processing.org/reference/IntList\_shuffle\_.html](https://Processing.org/reference/IntList_shuffle_.html)[https://Processing.org/reference/IntList\_array\_.html](https://Processing.org/reference/IntList_array_.html)

---

_[View the full topic](https://discourse.processing.org/t/repeating-and-randomizing-string-arrays/10811)._
