# How to create a pattern randomly without overlapping?

**URL:** <https://forum.kirupa.com/t/how-to-create-a-pattern-randomly-without-overlapping/313211>\
**Category:** flash\
**Created:** [August 24, 2010, 1:27am UTC](https://forum.kirupa.com/t/how-to-create-a-pattern-randomly-without-overlapping/313211 "2010-08-24T01:27:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![euniceee](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@euniceee](https://forum.kirupa.com/u/euniceee)\
**Post date:** [August 24, 2010, 1:27am UTC](https://forum.kirupa.com/t/how-to-create-a-pattern-randomly-without-overlapping/313211/1 "2010-08-24T01:27:24Z")

</div>

Hi, I am still a newbie to flash…still trying to learn AS3 =)  
I got some movie clips with different shapes and I would like to make a pattern from those movie clips. I have assigned the x y co-ordinates of those movie clips with the Math.random function. However, the shapes overlap all the time, what can I do to avoid it? Someone has suggested that I could add the clips to a list after being randomised, then define the area which couldn’t be place by the other movie clips. However, how can I define that area in AS3? I have tried to do the hitTest, but I am not too sure what should I do if it has detected a hit, since there’s a probability that it will hit another shape. Hope you guys could help me a bit!=)
