Math.random() not working in Chrome
See original GitHub issueChallenge Generate Random Fractions with JavaScript has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
function myFunction() {
// Only change code below this line.
return Math.random();
// Only change code above this line.
}
not working in Google Chrome but worked fine in Safari
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Why is Google Chrome's Math.random number generator not ...
Apparently Math.random() in V8 only works with 32 bit values (and didn't even correctly randomize all of those in the past). And with...
Read more >Google Chrome functions finally return actual random numbers
Math.random() was broken for years, but Google has finally fixed it.
Read more >r/javascript - Math.random() is broken in V8/Chrome/Node
I don't understand the problem. The most likely outcome of a short "Math.random() is broken for me, plz fix" bug report is a...
Read more >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 >Overwrite Standard Math.random() Function - Google Groups
The problem is that it isn't overwriting * the function prior to its initial execution. */ function main () { // ... Math.random...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it just seemed that Math.random() wasn’t doing anything.
i was writing “return Math.random();” and nothing happened. Went to Safari and I was able to finish the exercise.
On 02 Apr 2016, at 19:42, Eric Leung notifications@github.com wrote:
@vlory73 https://github.com/vlory73 can you give more details on what kind of errors are you getting? Or like how did you find out it was not working on Chrome?
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/FreeCodeCamp/FreeCodeCamp/issues/7859#issuecomment-204764646
@vekatobias maybe the code is wrong. I probably would do it differently today. But today I have substantial more experience than back then. Also, the intended solution of the exercise was this. In the end, it boils down to Safari working, whereas Chrome did not. I don’t mind that this is not addressed. In fact, I’m happy that raising it already helped a couple of people .