# Tricky array related problem

**URL:** https://forum.kirupa.com/t/tricky-array-related-problem/237050
**Category:** flash
**Created:** [August 26, 2007, 10:17pm UTC](https://forum.kirupa.com/t/tricky-array-related-problem/237050 "2007-08-26T22:17:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)
#### Post date: [August 26, 2007, 10:17pm UTC](https://forum.kirupa.com/t/tricky-array-related-problem/237050/1 "2007-08-26T22:17:40Z")

</div>

I’ll try to break this down as simple as I can.

I got this array with 5 values in it. they change through a random function like so;  
ActionScript Code:  
[FONT=Courier New][LEFT][COLOR=#000000] **var** [/COLOR] tArr:[COLOR=#0000FF]Array[/COLOR] = [COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR],[COLOR=#000080]1[/COLOR],[COLOR=#000080]2[/COLOR],[COLOR=#000080]3[/COLOR],[COLOR=#000080]4[/COLOR][COLOR=#000000]][/COLOR];

[COLOR=#000000] **function** [/COLOR] updateCOLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]  
tArr[COLOR=#000000][[/COLOR]whichone[COLOR=#000000]][/COLOR] = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]floor[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]random[/COLOR]COLOR=#000000[/COLOR] \* [COLOR=#000080]6[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR];  
[/LEFT]  
[/FONT]

Now, the problem is… I dont want any dups. Any of those 5 values can be 1 to 6, but they need to be unique. I mean, this is no good:

[1,1,2,5,6,6]

How would I do that? bit stumped : )

… oh its worth noting that this is in a time-critical function so I dont really want to “loop until one comes up”
