# Randomizing an array's trace statements by percentage

**URL:** <https://forum.kirupa.com/t/randomizing-an-arrays-trace-statements-by-percentage/324692>\
**Category:** flash\
**Created:** [September 3, 2011, 5:31pm UTC](https://forum.kirupa.com/t/randomizing-an-arrays-trace-statements-by-percentage/324692 "2011-09-03T17:31:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![humbuged](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@humbuged](https://forum.kirupa.com/u/humbuged)\
**Post date:** [September 3, 2011, 5:31pm UTC](https://forum.kirupa.com/t/randomizing-an-arrays-trace-statements-by-percentage/324692/1 "2011-09-03T17:31:14Z")

</div>

Hello 🙂

I have an array that I want to shuffle but at different percentages. Like “Hello” would show up 80% in the Output window. “Bye” would show the other 20% of the time.

How do I do this?

```auto

var myArray:Array = new Array("Hello", "Bye");

function randomIt()
{
	randomizeArray = random(myArray.length);
	trace(myArray[randomizeArray]);
}

setInterval(randomIt,1000);

```
