网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > 代码交流
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

代码交流 ASP,PHP,JSP等网站源代码下载与交流。

Reply
 
Thread Tools Display Modes
  #1   IP: 218.85.132.244
Old 2008-02-01, 11:02 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default php随机函数 rand

rand
(PHP 3, PHP 4 , PHP 5)

rand -- 产生一个随机数
说明
int rand ( [int min, int max])


如果没有提供可选参数 min 和 max,rand() 返回 0 到 RAND_MAX 之间的伪随机数。例如想要 5 到 15(包括 5 和 15)之间的随机数,用 rand(5, 15)。

注: 在某些平台下(例如 Windows)RAND_MAX 只有 32768。如果你需要的范围大于 32768,考虑用 mt_rand() 来替代之。

注: 在 PHP 4.2.0 中,无需用函数 srand() 或 mt_srand()来搜寻随机数生成器,它将被自动完成。

注: 在 3.0.7 之前的版本中,max 的含义是 range。要在这些版本中得到和上例相同 5 到 15 的随机数,简短的例子是 rand (5, 11)。
Reply With Quote
  #2   IP: 218.85.132.244
Old 2008-02-01, 11:28 AM
car car is offline
高级会员
 
Join Date: 2006-05-14
Posts: 534
car 正向着好的方向发展
Default

<?php
echo rand() . "\n";
echo rand() . "\n";

echo rand(5, 15);
?>
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 10:54 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.