# 2 arrays randomize together

**URL:** <https://forum.kirupa.com/t/2-arrays-randomize-together/195742>\
**Category:** flash\
**Created:** [August 2, 2006, 8:02pm UTC](https://forum.kirupa.com/t/2-arrays-randomize-together/195742 "2006-08-02T20:02:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![igby](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/igby/32/2060_2.png) [@igby](https://forum.kirupa.com/u/igby)\
**Post date:** [August 2, 2006, 8:02pm UTC](https://forum.kirupa.com/t/2-arrays-randomize-together/195742/1 "2006-08-02T20:02:16Z")

</div>

I’ve got 2 arrays that I want to randomize together. So if array one (1,2,3,4,5) is randomized to be (5,2,3,4,1), how can I have the second array randomize to that order?

///Here’s my randomize function///  
Array.prototype.rn= function()  
{  
ret= new Array();  
var copy= this.concat();  
while(copy.length \> 0)  
{  
rnd=int(Math.random()\*copy.length)  
ret.push(copy[rnd])  
copy.splice(rnd,1);  
}  
return ret  
}

///Here’s me calling the first array to be random///  
b=zArray.rn();

how can I say “make the xArray correspond with the random order of the zArray” with AS?

Thanks  
Igby
