View Full Version : Fixed length random number
05-18-2007, 07:52 PM
Hello all. I have been looking all over for a random number generator that will allow random numbers with an upper and lower limit. I would like something to generate between 1000 and 9999. Can anyone point me to the right place?
05-18-2007, 09:18 PM
Math.floor(Math.random() * 9000)) + 1000;
05-18-2007, 11:18 PM
That worked perfectly, although I had to remove an extra ')'.
Thanks so much,
05-19-2007, 12:43 AM
I didn't notice the typo - sorry.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.