SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: random number in php
-
Feb 9, 2000, 09:53 #1
- 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
-
Feb 9, 2000, 16:39 #2
- 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