# Random Unique

**URL:** https://forum.kirupa.com/t/random-unique/247922
**Category:** flash
**Created:** [January 1, 2008, 8:22pm UTC](https://forum.kirupa.com/t/random-unique/247922 "2008-01-01T20:22:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bern494](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@bern494](https://forum.kirupa.com/u/bern494)
#### Post date: [January 1, 2008, 8:22pm UTC](https://forum.kirupa.com/t/random-unique/247922/1 "2008-01-01T20:22:30Z")

</div>

Hi  
I am looking for help in develping my new project which involves selecting numbers, both randomly and uniqely. I have on stage 128 dynamic text boxes named myTextField1, myTextField2 etc etc up to 128, and I want to fill each box with a unique number from 1-128  
I would like to use a button to run this code and if possible to fill each box individually that is box1 then box2 etc.  
This is the code I am trying run but I cannot get it to give me 128 different numbers, it fills the fields ok but there are duplicates.

```auto
for (i=1; i<129; i++) {
   var temp:TextField = _root["myTextField" + i];
   temp.text = randFun();
}
function randFun() {
	var randomPick:Number = Math.ceil(Math.random()*128);
	return randomPick;
}

```

Any help please  
Bern
