SnakesBite101 Posted July 10, 2012 Report Share Posted July 10, 2012 For instance i know Math.random() returns a random number between 0 and 1i know Math.floor(Math.random()*11) returns a random # between 0 and 10 but say i wanted the random number to start from 5 and not 0. how do i go about doing this? Link to comment Share on other sites More sharing options...
thescientist Posted July 10, 2012 Report Share Posted July 10, 2012 (edited) var min = 5;var max = 10; Math.floor(Math.random() * (max - min + 1)) + min; https://developer.mo...cts/Math/random Edited July 10, 2012 by thescientist Link to comment Share on other sites More sharing options...
SnakesBite101 Posted July 10, 2012 Author Report Share Posted July 10, 2012 hey, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now