# Using a loop to duplicate and random x pos

**URL:** https://forum.kirupa.com/t/using-a-loop-to-duplicate-and-random-x-pos/240719
**Category:** Uncategorized
**Created:** [October 5, 2007, 11:57am UTC](https://forum.kirupa.com/t/using-a-loop-to-duplicate-and-random-x-pos/240719 "2007-10-05T11:57:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![juliecat](https://avatars.discourse-cdn.com/v4/letter/j/cab0a1/32.png) [@juliecat](https://forum.kirupa.com/u/juliecat)
#### Post date: [October 5, 2007, 11:57am UTC](https://forum.kirupa.com/t/using-a-loop-to-duplicate-and-random-x-pos/240719/1 "2007-10-05T11:57:46Z")

</div>

Hi people, got some code working to duplicate a movieclip, but what I’d really like to do is obviously randomise the movieclip’s x position so that it spreads across the stage, rather than stacking in the same position as it is now. Any clues greatly apprciated :!:

julie  
x

```auto
for (i=1; i<11; i++){
    
duplicateMovieClip("alien", "alien_new_"+i, 22-10, i);

}

```
