random numbers in android animation xml file
<p>I am trying to get my animation to go to a somewhat random location every time it occurs. </p>

<p>Here is my xml </p>

<pre><code>&lt;translate
    android:fromXDelta="0%"
    android:toXDelta="randomNumber%"
    android:fromYDelta="0%"
    android:toYDelta="-200%"
    android:duration="3000"
    android:zAdjustment="top" /&gt;
</code></pre>

<p>As you can see, I want the value for the XDelta to be random. But if I use</p>

<pre><code>    function random():void{
//calculating the random number
randomNumber = Math.round(Math.random() * (20));

    } 
</code></pre>

<p>I get a string and as I have read the XDelta only accepts floats or percents??? What is the correction? is there an easy way to change the string to a float/percent? any other ideas?</p>
