You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Math.random() function returns a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0, but not 1) with approximately uniform distribution over that range — which you can then scale to your desired range.
So that line of code is actually "Generate a random integer number between 0 and 358" instead of between 0 and 359, which is what should be expected given the semantics of the code.
Hi, looking at your code I noticed the line:
this.animation._stopAngle = Math.floor((Math.random() * 359));
According to the definition of Math.random() (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)
The Math.random() function returns a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0, but not 1) with approximately uniform distribution over that range — which you can then scale to your desired range.
So that line of code is actually "Generate a random integer number between 0 and 358" instead of between 0 and 359, which is what should be expected given the semantics of the code.
The line of code should be changed to:
this.animation._stopAngle = Math.floor((Math.random() * 360));
The text was updated successfully, but these errors were encountered: