# I just want a damn random number, no repeats, how hard could this really be?

**URL:** <https://forum.kirupa.com/t/i-just-want-a-damn-random-number-no-repeats-how-hard-could-this-really-be/269477>\
**Category:** Uncategorized\
**Created:** [August 28, 2008, 4:18am UTC](https://forum.kirupa.com/t/i-just-want-a-damn-random-number-no-repeats-how-hard-could-this-really-be/269477 "2008-08-28T04:18:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jynx](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@jynx](https://forum.kirupa.com/u/jynx)\
**Post date:** [August 28, 2008, 4:18am UTC](https://forum.kirupa.com/t/i-just-want-a-damn-random-number-no-repeats-how-hard-could-this-really-be/269477/1 "2008-08-28T04:18:14Z")

</div>

i have been trying to figure this out for a few hours now. actionscript seems to have no main method, and i cant seem to follow its flow. i have been trying to generate a non repeated random number for a couple of hours now and im getting extremely pissed off that its not working.

```auto
// define pictures
pic_arr = ["images/goldstein.png", "images/kyle.png", "images/timmy.png"];
var oldRN:Number = 10;
player_mc.createEmptyMovieClip("holder1",2);
this.onLoad(display());

function display() {
    ranNum = Math.floor(Math.random()*pic_arr.length);
        while(ranNum == oldRN){
        ranNum = Math.floor(Math.random()*pic_arr.length);
        }
        trace(ranNum);
        oldRN = ranNum;
        player_mc.holder1.loadMovie(pic_arr[ranNum]);
};

```
