# Array Question

**URL:** https://forum.kirupa.com/t/array-question/157973
**Category:** Uncategorized
**Created:** [August 5, 2005, 3:16pm UTC](https://forum.kirupa.com/t/array-question/157973 "2005-08-05T15:16:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![nimbusism](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nimbusism](https://forum.kirupa.com/u/nimbusism)
#### Post date: [August 5, 2005, 3:16pm UTC](https://forum.kirupa.com/t/array-question/157973/1 "2005-08-05T15:16:15Z")

</div>

I am having problems understanding arrays. More exact, how to output them in a fashion. Say i have this array of five items, and i want to output them items starting first with a random number and then increasing by one until the array reaches the last index. But say the random number is 2? It would diplay 2 through 4 but not display 0 or 1. I would like to display 0 through what ever the initial random number was. In this case 2 through 4 would display, i would then like the 0 through 1 to display after. Here’s a sample of what i have been toying with.

```auto
//name_of_array = ["one", "two", "three","value4","value5","value6","value7","value8","value9","value10"];
var one:String = "value1";
var two:String = "value2";
var three:String = "value3";
var four:String = "value4";
var five:String = "value5";

name_of_array = [one, two, three, four, five];
txtValues.text = name_of_array[2];
//loop through the array
//to make this start on a random number, z has to randomized
//var numRand:number = randomize code
//for(z=numRand; z<name_of_array.length; ++z){
var num = Math.round(Math.random()*5);

for(z=num; z<name_of_array.length; ++z){
	
		trace(name_of_array[z])
		
		txtValues.text = name_of_array;
} 

```
