question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Documentation]: Question about Math.random().

See original GitHub issue

MDN - Math.random() says the function returns a a floating-point number in the range 0 to less than 1 (inclusive of 0, but not 1), MDN doesn’t describe in math expression.

https://github.com/mrdoob/three.js/blob/aec286294515e5a4f60a00e7daf05fe1558e9aaa/docs/api/en/math/Vector2.html#L337

I am not sure it make sense or better, change a random value [0-1] to a random value [0-1) , a random value [0~1) or a random value [0,1).

How about Sets the x and y components of this vector to a random value in the range 0 to less than 1 (inclusive of 0, but not 1).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mrdoobcommented, Apr 7, 2020

I wouldn’t think mathematicians are the target users of the library… I wouldn’t know what [0, 1) means. I think it’s helpful to say a value between 0 and 1, excluding 1.

2reactions
WestLangleycommented, Apr 7, 2020

2nd attempt: 😃

Sets each component of this vector to a pseudo-random value between 0 and 1, excluding 1.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Math.random() - JavaScript - MDN Web Docs
The Math.random() function returns a floating-point, pseudo-random number that's greater than or equal to 0 and less than 1, with approximately uniform ...
Read more >
Java Math random() method with Examples - GeeksforGeeks
The java.lang.Math.random() method returns a pseudorandom double type number greater than or equal to 0.0 and less than 1.0. . When this method ......
Read more >
Java Math.random() Method with Examples - Javatpoint
Math.random() is used to return a pseudorandom double type number greater than or equal to 0.0 and less than 1.0. The default random...
Read more >
how does Math.floor(Math.random()*2) work??? & question on ...
Math.random() * 2 returns any number (including decimal values) between 0(inclusive) and 2(exclusive). Now, when you compute Math.floor() on these values, ...
Read more >
JavaScript Math random() Method - W3Schools
The Math.random() method returns a random number from 0 (inclusive) up to but not including 1 (exclusive). Note. Math.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found