Coderwall
Ruby
Python
JavaScript
Front-End
Tools
iOS
More
Tips
Ruby
Python
JavaScript
Front-End
Tools
iOS
PHP
Android
.NET
Java
Jobs
Jobs
Sign In or Up
Joined October 2013
·
html games
Paul Finnerty
United Kingdom
·
0 Protips
1 Comments
Posted to
Shortest code for random number between 1 and N in JavaScript
over 1 year ago
And for the same with -ve random numbers: ~(Math.random() * N)
Achievements
1 Karma
0 Total ProTip Views
And for the same with -ve random numbers: ~(Math.random() * N)