Home > Backend Development > PHP Tutorial > 在php中 0.5019163067261818这种格式是怎么生成的?

在php中 0.5019163067261818这种格式是怎么生成的?

WBOY
Release: 2016-06-20 12:34:03
Original
976 people have browsed it

最近在做一个模拟提交的代码,有个参数是这样的temp=0.5019163067261818,不知道是什么生成的,请知道的朋友告诉一下,谢谢。


回复讨论(解决方案)

js生产的
Math.random()

js

<script type="text/javascript">document.write(Math.random());</script>
Copy after login


php
echo mt_rand() / mt_getrandmax();
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template