Random number always 0 : <p>I have a function that generates a number and i'm pushing it into my array, but the number generated is always 0, why  ?</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function generateId()
{
    var randomNum = Math.floor((Math.random()*10) + 1); 

    if(randomNum = ids.indexOf(randomNum)) 
    {
        return generateId();
    };

    ids.push[randomNum];

    return randomNum;
};</code></pre>
</div>
</div>
</p>
