View Full Version : Fixed length random number
05-18-2007, 08: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, 10:18 PM
Math.floor(Math.random() * 9000)) + 1000;
05-19-2007, 12:18 AM
That worked perfectly, although I had to remove an extra ')'.
Thanks so much,
05-19-2007, 01:43 AM
I didn't notice the typo - sorry.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.