# Experimental Code

**URL:** <https://forum.kirupa.com/t/experimental-code/21780>\
**Category:** flash\
**Created:** [May 26, 2003, 9:14am UTC](https://forum.kirupa.com/t/experimental-code/21780 "2003-05-26T09:14:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TOOL](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@TOOL](https://forum.kirupa.com/u/TOOL)\
**Post date:** [May 26, 2003, 9:14am UTC](https://forum.kirupa.com/t/experimental-code/21780/1 "2003-05-26T09:14:49Z")

</div>

I’m just experimenting with some code in MX and thought that this code would loop through 15 times and draw 15 random lines…when I test the movie, nothing appears…what am I doing wrong?

Thanks.

[AS]\_root.createEmptyMovieClip(“clip”, 1);  
for (i; i\>15; i++) {  
x1 = Math.floor(Math.random()_(250-2))+2;  
x2 = Math.floor(Math.random()_(250-2))+2;  
y1 = Math.floor(Math.random()_(250-2))+2;  
y2 = Math.floor(Math.random()_(250-2))+2;  
clip.lineStyle(3, 0x000000, 100);  
clip.moveTo(x1, y1);  
clip.lineTo(x2, y2);  
}[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2003, 9:18am UTC](https://forum.kirupa.com/t/experimental-code/21780/2 "2003-05-26T09:18:30Z")

</div>

If I’m not mistaken, you forgot to state what the variable i would be. I also switched the greater sign to less than 15. Try this and see if it works.

[AS]\_root.createEmptyMovieClip(“clip”, 1);  
for (i=0; i\<15; i++) {  
x1 = Math.floor(Math.random()_(250-2))+2;  
x2 = Math.floor(Math.random()_(250-2))+2;  
y1 = Math.floor(Math.random()_(250-2))+2;  
y2 = Math.floor(Math.random()_(250-2))+2;  
clip.lineStyle(3, 0x000000, 100);  
clip.moveTo(x1, y1);  
clip.lineTo(x2, y2);  
}  
[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2003, 10:13am UTC](https://forum.kirupa.com/t/experimental-code/21780/3 "2003-05-26T10:13:52Z")

</div>

yeah that worked, thanks electrongeek 🙂 good to know i wasn’t that far from the correct code 😛
