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

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

WBOY
WBOYOriginal
2016-06-20 12:34:03950browse

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


回复讨论(解决方案)

js生产的
Math.random()

js

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


php
echo mt_rand() / mt_getrandmax();

Statement:
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