# Math.random problem

**URL:** <https://forum.kirupa.com/t/math-random-problem/320915>\
**Category:** Uncategorized\
**Created:** [April 5, 2011, 3:23pm UTC](https://forum.kirupa.com/t/math-random-problem/320915 "2011-04-05T15:23:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon1](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@simon1](https://forum.kirupa.com/u/simon1)\
**Post date:** [April 5, 2011, 3:23pm UTC](https://forum.kirupa.com/t/math-random-problem/320915/1 "2011-04-05T15:23:11Z")

</div>

hi there i am using actionscript 3, and the problem that I have is that i am creating an array of 16 buttons and need to use the function math.random to get it to pick 5 random unique numbers out of the array. how do i do this?  
as at the moment it is sometimes picking 5 unique numbers and sometimes it has duplicate buttons appearing?

Thanks in advance
