# Need serious help with random images and placement!

**URL:** https://forum.kirupa.com/t/need-serious-help-with-random-images-and-placement/327653
**Category:** flash
**Created:** [March 16, 2012, 10:42pm UTC](https://forum.kirupa.com/t/need-serious-help-with-random-images-and-placement/327653 "2012-03-16T22:42:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![plextor30](https://avatars.discourse-cdn.com/v4/letter/p/c77e96/32.png) [@plextor30](https://forum.kirupa.com/u/plextor30)
#### Post date: [March 16, 2012, 10:42pm UTC](https://forum.kirupa.com/t/need-serious-help-with-random-images-and-placement/327653/1 "2012-03-16T22:42:20Z")

</div>

I know math.random is a good thing to use here, but I have no clue how to do it.

I’m creating a small basic fish tank for a friends little girl, and I have the fish, but want to generate 5 random fishes and randomly place the fish in the tank, while also giving the fishes random sizes. Anyone know how I could do that?

here is my code:

for(var i:uint = 0; i\<5; i++)  
{

```
            var schoolOfFishes:YellowFish = new YellowFish();
            this.addChild(schoolOfFishes);
            schoolOfFishes.x = 20 * i;
            schoolOfFishes.y = 20 * i;
            schoolOfFishes.width = 30;
            schoolOfFishes.height = 30;
            schoolOfFishes.rotation = 180;
            schoolOfFishes.scaleX *= -1;
            schoolOfFishes.scaleY *= -1;
            
        
        }

```

I managed to get 5 fishes, but it isn’t how I wanted it. It should be random in the tank
