How to make my Image move in a random direction?
<p>I have an image that rotating in a counter clockwise direction. Now, I want it to move in a random direction during or whenever it touch the wall. The problem is I can't do it, please help me about this matter.</p>

<p>This is my code :  </p>

<pre><code>private double x;
private double y;
private double speed;

public void move(long dt)
{
    double dt_s = dt / 1e9;
    double dx = speed * dt_s;
    double dy = speed * dt_s;

    final double right_border = 100;
    final double up_border = 100;
    final double down_border = 0.0;
    final double left_border = 0.0;


    x += dx;

    if (x &gt;= right_border)
    {
        x = right_border;
      if (y &gt;= down_border)
       {               
    y += dy;
       }

    }
    if (y &gt; up_border)
    {
        y = up_border;
        if (x &gt;= left_border)
        {
            speed *= -1;
        }

    }
    if (x &lt;= left_border)
    {
        x = left_border;
        if (y &lt;= up_border)
        {
            y += dy;
        }

    }
    if (y &lt; down_border)
    {
        y = down_border;
        if (x &lt;= right_border)
        {
            speed *= -1;
        }

    }

 }
</code></pre>
