<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta content="text/html; charset=utf-8">
</head>
<body>
I suspect you didn't get any replies before due the impressively complicated set of OR statements in that loop. I suspect the problem is there somewhere but imagine it world be a nightmare to track it down. My guess is the loop never exits, whether due to an
 error or impossible constraints.<br>
<br>
What if instead you enumerated the possible legal combinations of positions in a nested List and then just sampled one of them per trial?<br>
<br>
Good luck,<br>
David V<br>
<br>
<div id="htc_header" style="">----- Reply message -----<br>
From: "tamiskovich@gmail.com" <tamiskovich@gmail.com><br>
To: "e-prime@googlegroups.com" <e-prime@googlegroups.com><br>
Subject: Help with Randomization of Non-Overlapping Images<br>
Date: Fri, Aug 1, 2014 6:30 pm<br>
<br>
</div>
<br>
<br>
<div>
<div dir="ltr">Does anyone have any suggestions on this? I'm stuck on this and eprime support directed me here.
<div><br>
</div>
<div>Tara<br>
<br>
On Monday, July 28, 2014 3:43:33 PM UTC-5, Tara Miskovich wrote:
<blockquote class="gmail_quote" style="margin:0; margin-left:0.8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">Hello,
<div><br>
</div>
<div>I am working on having 4 images randomly places within a rectangular region without overlapping. I wrote the code below, and it appears to be working with up to Image 3 added, but when I add in the forth image the program freezes. I am hoping for some
 guidance with what to try next or how to get past this. Here is the code I wrote to randomize the x and y location for each image.</div>
<div><br>
</div>
<div>Thanks!</div>
<div>Tara</div>
<div><br>
</div>
<div>
<div>Dim x1 As Integer</div>
<div>Dim x2 As Integer</div>
<div>Dim x3 As Integer</div>
<div>Dim x4 As Integer</div>
<div>Dim y1 As Integer</div>
<div>Dim y2 As Integer</div>
<div>Dim y3 As Integer</div>
<div>Dim y4 As Integer</div>
<div><br>
</div>
<div>x1 = random(36, 42)</div>
<div>y1 = random(38, 60)</div>
<div><br>
</div>
<div>Do</div>
<div>x2 = random(36, 42)</div>
<div>y2 = random(38, 60)</div>
<div>x3 = random(36, 42)</div>
<div>y3 = random(38, 60)</div>
<div>x4 = random(36, 42)</div>
<div>y4 = random(38, 60)</div>
<div><br>
</div>
<div><br>
</div>
<div>Loop While (x2 = x1 Or x2 = x1 + 1 Or x2 = x1+2 Or x2 = x1 - 1 Or x2 = x1 - 2 _</div>
<div>And y2 = y1 Or y2 = y1 + 1 Or y2 = y1 + 2 Or y2 = y1 + 3 Or y2 = y1 - 1 Or y2 = y1 - 2 Or y2 = y1 - 3)_</div>
<div>Or (x3 = x1 Or x3 = x1 + 1 Or x3 = x1+2 Or x3 = x1 - 1 Or x3 = x1 - 2 _</div>
<div>And y3 = y1 Or y3 = y1 + 1 Or y3 = y1 + 2 Or y3 = y1 + 3 Or y3 = y1 - 1 Or y3 = y1 - 2 Or y3 = y1 - 3)_</div>
<div>Or (x3 = x2 Or x3 = x2 + 1 Or x3 = x2+2 Or x3 = x2 - 1 Or x3 = x2 - 2 _</div>
<div>And y3 = y2 Or y3 = y2 + 1 Or y3 = y2 + 2 Or y3 = y2 + 3 Or y3 = y2 - 1 Or y3 = y2 - 2 Or y3 = y2 - 3)_</div>
<div>or (x4 = x1 Or x4 = x1 + 1 Or x4 = x1+2 Or x4 = x1 - 1 Or x4 = x1 - 2 _</div>
<div>And y4 = y1 Or y4 = y1 + 1 Or y4 = y1 + 2 Or y4 = y1 + 3 Or y4 = y1 - 1 Or y4 = y1 - 2 Or y4 = y1 - 3)_</div>
<div>Or (x4 = x2 Or x4 = x2 + 1 Or x4 = x2 + 2 Or x4 = x2 - 1 Or x4 = x2 - 2 _</div>
<div>And y4 = y2 Or y4 = y2 + 1 Or y4 = y2 + 2 Or y4 = y2 + 3 Or y4 = y2 - 1 Or y4 = y2 - 2 Or y4 = y2 - 3)_</div>
<div>Or (x4 = x3 Or x4 = x3 + 1 Or x4 = x3 + 2 Or x4 = x3 - 1 Or x4 = x3 - 2 _</div>
<div>And y4 = y3 Or y4 = y3 + 1 Or y4 = y3 + 2 Or y4 = y3 + 3 Or y4 = y3 - 1 Or y4 = y3 - 2 Or y4 = y3 - 3)</div>
<div><br>
</div>
<div>c.SetAttrib "x1", x1</div>
<div>c.SetAttrib "x2", x2</div>
<div>c.SetAttrib "x3", x3</div>
<div>c.SetAttrib "x4", x4</div>
<div>c.SetAttrib "y1", y1</div>
<div>c.SetAttrib "y2", y2</div>
<div>c.SetAttrib "y3", y3</div>
<div>c.SetAttrib "y4", y4</div>
</div>
</div>
</blockquote>
</div>
</div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to
<a href="mailto:e-prime+unsubscribe@googlegroups.com">e-prime+unsubscribe@googlegroups.com</a>.<br>
To post to this group, send email to <a href="mailto:e-prime@googlegroups.com">e-prime@googlegroups.com</a>.<br>
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/e-prime/8d0ddea8-f54e-4a98-a006-cdcbed5cc8ce%40googlegroups.com?utm_medium=email&utm_source=footer">
https://groups.google.com/d/msgid/e-prime/8d0ddea8-f54e-4a98-a006-cdcbed5cc8ce%40googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.<br>
</div>
</body>
</html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:e-prime+unsubscribe@googlegroups.com">e-prime+unsubscribe@googlegroups.com</a>.<br />
To post to this group, send email to <a href="mailto:e-prime@googlegroups.com">e-prime@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/e-prime/B628F720-33AE-48CB-B973-CA5AA81AC8E3%40ucl.ac.uk?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/e-prime/B628F720-33AE-48CB-B973-CA5AA81AC8E3%40ucl.ac.uk</a>.<br />
For more options, visit <a href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.<br />