Re: Random number
| From: | Augusto Cesar Castoldi | Date: | Thu, 30 Aug 2001 19:39:05 +0000 |
| Subject: | Re: Random number | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65365@lists.php.net to get a copy of this message | ||
Use this function, the "$num" argument, is the total
of numbers. Ex: if $num is 5, the funtion will return
"56743", is five numbers.
function random($num)
{
srand ((double) microtime() * 1000000);
$temp = rand().rand().rand();
$temp = substr($temp, 0, $num);
return $temp;
} //fim function random
--- Rosen <rosen_dm@dir.bg> escreveu: > Hi,
> I'm using PHP code from manual:
> srand( (double) microtime() * 1000000);
> // Get random User ID
> $uid=rand();
>
> but it dowsn't work !
>
> Thanks,
>
> Rosen
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
_______________________________________________________________________________________________
Yahoo! GeoCities
Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. É fácil e grátis!
http://br.geocities.yahoo.com/