主题:  PHP中的随机函数是什么?

爱多媒体爱生活

职务:普通成员
等级:2
金币:1.0
发贴:303
注册:2003/2/20 14:25:56
#12003/9/14 18:11:37
如标题!



大雪糕

职务:普通成员
等级:2
金币:10.0
发贴:579
注册:2002/2/2 11:30:51
#22003/9/14 21:41:03
rand()啊,其实这种问题你翻翻PHP手册就知道了



blueoxygen

职务:普通成员
等级:1
金币:0.0
发贴:5
注册:2002/9/14 15:42:13
#32003/9/15 20:04:27
int rand ( [int min, int max])


If called without the optional min, max arguments rand() returns a pseudo-random value between 0 and RAND_MAX. If you want a random number between 5 and 15 (inclusive), for example, use rand (5, 15).

In older versions of PHP, you had to seed the random number generator before use with srand(). Since 4.2.0 this is no longer necessary.



helmet

职务:版主
等级:4
金币:10.0
发贴:1559
注册:2004/1/30 15:59:27
#42003/9/26 18:39:01
520media在上个帖子中说
引用:
如标题!


在手册里搜索rand(),srand()。