# Random letter creator

**URL:** <https://forum.kirupa.com/t/random-letter-creator/12961>\
**Category:** Uncategorized\
**Created:** [February 6, 2003, 7:18pm UTC](https://forum.kirupa.com/t/random-letter-creator/12961 "2003-02-06T19:18:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![postatomic](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@postatomic](https://forum.kirupa.com/u/postatomic)\
**Post date:** [February 6, 2003, 7:18pm UTC](https://forum.kirupa.com/t/random-letter-creator/12961/1 "2003-02-06T19:18:09Z")

</div>

Hi

I’m trying to get the effect of letters cycling randomly until it gets to the correct letter and then stops…so you can have a word cycle randomly until it creates the word you want.

how can I achieve that in MX

postatomic :evil:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 7:27pm UTC](https://forum.kirupa.com/t/random-letter-creator/12961/2 "2003-02-06T19:27:36Z")

</div>

There are 2 random letter cycling tutorials on this site…

[http://www.kirupa.com/developer/flash5/randomlettercycling.asp](http://www.kirupa.com/developer/flash5/randomlettercycling.asp)

[http://www.kirupa.com/developer/flash5/randomlettercycling2.asp](http://www.kirupa.com/developer/flash5/randomlettercycling2.asp)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 7:37pm UTC](https://forum.kirupa.com/t/random-letter-creator/12961/3 "2003-02-06T19:37:18Z")

</div>

you might want to see [http://www.kirupaforum.com/showthread.php?s=&threadid=11686](http://www.kirupaforum.com/showthread.php?s=&threadid=11686)

there is a function

Math.randomRange = function(min, max){  
return Math.floor(Math.random()\*(max-min+1)) + min;  
}

which can be used with the range of letters in char codes 97-122 (a-z) and be checked for correctness

simple example

```auto

Math.randomRange = function(min, max){
	return Math.floor(Math.random()*(max-min+1)) + min;
}
checkFor = "a";
this.onEnterFrame = function(){
	charValue = Math.randomRange(97,122);
	if (checkFor == String.fromCharCode(charValue)){
		trace("Found match: "+ checkFor +" and "+ String.fromCharCode(charValue) +" ("+ charValue +")")
	}
}

```

this doesnt stop, just traces a message, but you get the point

[edit]  
or see the previous links 🙂
