SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2000
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how can I make a random number generator in php3? I want a simple function that will put a number between 1 and whatever on the html code

  2. #2
    SitePoint Zealot
    Join Date
    Nov 1999
    Location
    Manhattan!
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do this:

    <?
    srand((double)microtime()*1000000);
    $randNum = rand(0,max);
    ?>

    just replace max with the maximum number you want... You can also specify a minimum value by replacing the 0 with another value.

    Christian


    ------------------
    Axie automatically performs free, customizable searches for new
    websites and delivers the links to members by personalized email.
    http://www.axie.com/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •