PHP srand() 函数

PHP 教程 · 2019-01-27 10:28:40

实例

播种随机数生成器:

<?php
srand(mktime());
echo(rand());
?>

定义和用法

srand() 函数播种随机数生成器(rand())。

提示:从 PHP 4.2.0 开始,随机数生成器自动播种,因此没有必要使用该函数。

语法

srand(seed);

参数 描述
seed 可选。规定播种值。

技术细节

返回值: 无。
返回类型: -
PHP 版本: 4+
PHP 更新日志: PHP 4.2.0:随机数生成器自动播种。

点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Algorithms and Data Structures

Algorithms and Data Structures

Kurt Mehlhorn、Peter Sanders / Springer / 2008-08-06 / USD 49.95

Algorithms are at the heart of every nontrivial computer application, and algorithmics is a modern and active area of computer science. Every computer scientist and every professional programmer shoul......一起来看看 《Algorithms and Data Structures》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具