Thread: Random Numbers

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    1
    Rep Power
    0
    I need a short script that will generate a random number that is five digits long. It only needs to be pseudo-random - int(rand()+1) works fine, but I do not know how to get it to return me 5 digits at all times. Thanks,

    Joe
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 1999
    Posts
    119
    Rep Power
    15
    ummm... for loop, and append (.= operator) to the string....

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by habiem:
    I need a short script that will generate a random number that is five digits long. It only needs to be pseudo-random - int(rand()+1) works fine, but I do not know how to get it to return me 5 digits at all times. Thanks,

    Joe
    [/quote]

  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 1999
    Location
    Bombay,Maharastra,India
    Posts
    8
    Rep Power
    0
    $random = (rand 9999) + 10000;

IMN logo majestic logo threadwatch logo seochat tools logo