Fix ultra-rare case of jiggle = 0
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
/**
|
||||
* @return {number} a random number.
|
||||
* @return {number} a very small non-zero random number.
|
||||
*/
|
||||
export default function() {
|
||||
return (Math.random() - 0.5) * 1e-6;
|
||||
let rand;
|
||||
do {
|
||||
rand = (Math.random() - 0.5) * 1e-6;
|
||||
while (rand === 0);
|
||||
return rand;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user