# Random numbers not working for me in AS3

**URL:** <https://forum.kirupa.com/t/random-numbers-not-working-for-me-in-as3/319398>\
**Category:** flash\
**Created:** [February 18, 2011, 10:51pm UTC](https://forum.kirupa.com/t/random-numbers-not-working-for-me-in-as3/319398 "2011-02-18T22:51:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsmadman](https://avatars.discourse-cdn.com/v4/letter/i/34f0e0/32.png) [@itsmadman](https://forum.kirupa.com/u/itsmadman)\
**Post date:** [February 18, 2011, 10:51pm UTC](https://forum.kirupa.com/t/random-numbers-not-working-for-me-in-as3/319398/1 "2011-02-18T22:51:43Z")

</div>

Man guys if u could help me with this it would be great check it “textBubble” is a movieclip that has 13 frames now i wanted to section off the different frames in this fashion 1,2,3,4 5,6,7,8 9,10,11,12. 1-4 equals broken femur Hints while concussionHints= 5,6,7,8 and etc… my issue is that the number comeing from the if then statements is no staying in there groups. i may get 1 then 11 then 5 instead of what i want which is 1 then 4 then 2, which is staying in that set array of numbers. Is what i want to do comeing across clearly

var brokenfemurHints=1;  
var concussionHints=2;  
var foodPosioningHints=3;

function hintClick(event:MouseEvent):void {

var textBubble = new TextBubble();

```
	addChild(textBubble);
	textBubble.x=395;
	textBubble.y=250;
	trace("working");
	var randomText:Number=Math.ceil(Math.random()*3);

```

var randomThree:Number=Math.ceil(Math.random()\*3);

```
	if (randomThree == brokenfemurHints) {
		var brokenFemur:Number=Math.ceil(Math.random()*4);
		textBubble.gotoAndStop(brokenFemur);
		trace(brokenFemur)
		
	}
	if (randomThree == concussionHints) {
		var Concussion:Number=Math.ceil(4+Math.random()*4);
		textBubble.gotoAndStop(Concussion);
		trace(Concussion)
		
	}
	if (randomThree == foodPosioningHints) {
		var FoodPosioning:Number=Math.ceil(8+Math.random()*4);
		textBubble.gotoAndStop(FoodPosioning);
		trace(FoodPosioning)
		}
	}
```
