while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
If that's the purpose, the loop in question does not do it. 1 is still out of bounds, only now only 0 is too.If you want what the comment says, 1-Math.random() does it very simply.
while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
If that's the purpose, the loop in question does not do it. 1 is still out of bounds, only now only 0 is too.If you want what the comment says, 1-Math.random() does it very simply.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...