Using results from another array

Let’s suppose that I have something like this:

dogs = new Array();
for (var i:int = 1; i <= 30; i++)

This would produce 30 numbers in an array from 1-30. From there I wish to randomise the array.

function randomiseArray(a:*, b:*):int {
    return 1-Math.floor(Math.random()*2.9999);

Suppose now I wanted to use only the first 5 numbers of the results in another array - what would be the best way of doing this?


Any takers on this?? - it is an interesting one …

var newArray:Array = dogs.slice(0,5);

Just wanted to say that was it - thanks so much EastCoast