...

View Full Version : Fixed length random number



parallon
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?

Thanks,

Parallon

felgall
05-18-2007, 09:18 PM
Math.floor(Math.random() * 9000)) + 1000;

parallon
05-18-2007, 11:18 PM
That worked perfectly, although I had to remove an extra ')'.

Thanks so much,

Parallon

felgall
05-19-2007, 12:43 AM
I didn't notice the typo - sorry.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum