# AS2 - Help with Random text script

**URL:** <https://forum.kirupa.com/t/as2-help-with-random-text-script/274146>\
**Category:** flash\
**Created:** [October 25, 2008, 11:06pm UTC](https://forum.kirupa.com/t/as2-help-with-random-text-script/274146 "2008-10-25T23:06:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darthphunk](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@darthphunk](https://forum.kirupa.com/u/darthphunk)\
**Post date:** [October 25, 2008, 11:06pm UTC](https://forum.kirupa.com/t/as2-help-with-random-text-script/274146/1 "2008-10-25T23:06:35Z")

</div>

Hey there.

I’m using the following script to load a random quote from a text file:

ranQuote = new LoadVars();  
ranQuote.onLoad = function(success) {

if (success) {

RanNum = Math.ceil(Math.random()\*25);  
ran = this[“quote”+RanNum];  
quote\_txt.text = ran;

}  
else {

quote\_txt.text = “The text failed to load due to an error”;

}

}  
ranQuote.load(“questions.txt”);

Is there a line or two that I can add to this that would prevent it from choosing the previously pick number again? I mean it can use it again, just not twice in a row.

Help please?

Thanks!
