# Getting unique random numbers

**URL:** <https://forum.kirupa.com/t/getting-unique-random-numbers/219866>\
**Category:** Uncategorized\
**Created:** [March 20, 2007, 7:52pm UTC](https://forum.kirupa.com/t/getting-unique-random-numbers/219866 "2007-03-20T19:52:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icy\_Penguin](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@Icy\_Penguin](https://forum.kirupa.com/u/Icy_Penguin)\
**Post date:** [March 20, 2007, 7:52pm UTC](https://forum.kirupa.com/t/getting-unique-random-numbers/219866/1 "2007-03-20T19:52:24Z")

</div>

Hey all,

I have a custom slideshow that I’ve made that has a set of four images changing every 5 seconds. The images are randomly selected by a random number between 0 and the length of my XML.

My question is, how can I get four _unique_ random numbers - i.e., getting 1, 4, 6, and 8 rather than 1, 4, 6, and 6?

So once a random number is selected, it can’t be selected again.

Thanks
