# Math.random problem

**URL:** <https://forum.kirupa.com/t/math-random-problem/255038>\
**Category:** flash\
**Created:** [March 18, 2008, 2:12pm UTC](https://forum.kirupa.com/t/math-random-problem/255038 "2008-03-18T14:12:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rundevo](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@Rundevo](https://forum.kirupa.com/u/Rundevo)\
**Post date:** [March 18, 2008, 2:12pm UTC](https://forum.kirupa.com/t/math-random-problem/255038/1 "2008-03-18T14:12:06Z")

</div>

Hi guys and gals

I have a slight problem with a site that I´m building.

I have 3 containers on the stage that I want to load 3 DIFFERENT images from a folder containing 15 jpgs into.

So my question is, how on earth do you tell the script to NOT load a random image that has been randomly chosen in container 1 into container 2 or 3?

Just to clarify and to avoid misunderstandings, if I got a random number of say, 3 to load into my first container on the stage, then I dont want that number to be available to the random function in container 2 or 3

This is the code that I´m using now

var \_random1:Number = (Math.ceil(Math.random() \* 15));  
var \_random2:Number = (Math.ceil(Math.random() \* 15));  
var \_random3:Number = (Math.ceil(Math.random() \* 15));

var loader1:Loader = new Loader();  
loader1.load(new URLRequest(“images/image” + \_random1 + “.jpg”));  
image1.addChild(loader1);

var loader2:Loader = new Loader();  
loader2.load(new URLRequest(“images/image” + \_random2 + “.jpg”));  
image2.addChild(loader2);

var loader3:Loader = new Loader();  
loader3.load(new URLRequest(“images/image” + \_random3 + “.jpg”));  
image3.addChild(loader3);

Regards  
/rundevo
