• <i id='ugX1z'><tr id='ugX1z'><dt id='ugX1z'><q id='ugX1z'><span id='ugX1z'><b id='ugX1z'><form id='ugX1z'><ins id='ugX1z'></ins><ul id='ugX1z'></ul><sub id='ugX1z'></sub></form><legend id='ugX1z'></legend><bdo id='ugX1z'><pre id='ugX1z'><center id='ugX1z'></center></pre></bdo></b><th id='ugX1z'></th></span></q></dt></tr></i><div id='ugX1z'><tfoot id='ugX1z'></tfoot><dl id='ugX1z'><fieldset id='ugX1z'></fieldset></dl></div>

      <tfoot id='ugX1z'></tfoot>

      1. <small id='ugX1z'></small><noframes id='ugX1z'>

        <legend id='ugX1z'><style id='ugX1z'><dir id='ugX1z'><q id='ugX1z'></q></dir></style></legend>
          <bdo id='ugX1z'></bdo><ul id='ugX1z'></ul>

        0 到 1.0 php 之间的随机浮点数

        Random float number between 0 and 1.0 php(0 到 1.0 php 之间的随机浮点数)

            <i id='aEXfJ'><tr id='aEXfJ'><dt id='aEXfJ'><q id='aEXfJ'><span id='aEXfJ'><b id='aEXfJ'><form id='aEXfJ'><ins id='aEXfJ'></ins><ul id='aEXfJ'></ul><sub id='aEXfJ'></sub></form><legend id='aEXfJ'></legend><bdo id='aEXfJ'><pre id='aEXfJ'><center id='aEXfJ'></center></pre></bdo></b><th id='aEXfJ'></th></span></q></dt></tr></i><div id='aEXfJ'><tfoot id='aEXfJ'></tfoot><dl id='aEXfJ'><fieldset id='aEXfJ'></fieldset></dl></div>

              <tbody id='aEXfJ'></tbody>

              <bdo id='aEXfJ'></bdo><ul id='aEXfJ'></ul>
            • <legend id='aEXfJ'><style id='aEXfJ'><dir id='aEXfJ'><q id='aEXfJ'></q></dir></style></legend>

              <small id='aEXfJ'></small><noframes id='aEXfJ'>

                • <tfoot id='aEXfJ'></tfoot>

                  本文介绍了0 到 1.0 php 之间的随机浮点数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  可能重复:
                  php中的随机浮点数

                  是否可以创建一个介于 0 和 1.0 之间的随机浮点数,例如 0.4、0.8 等.我使用了 rand 但它只接受整数.

                  Is it possible to create a random float number between 0 and 1.0 e.g 0.4, 0.8 etc. I used rand but it only accepts integers.

                  推荐答案

                  mt_rand() / mt_getrandmax();
                  

                  避免使用 rand() 函数,因为它通常依赖于平台的 C rand() 实现,通常以非常简单的模式创建数字.请参阅 php.net 上的此评论

                  Avoid the rand() function, since it usually depends on the platform's C rand() implementation, generally creating numbers with a very simple pattern. See this comment on php.net

                  更新:在 php 7.1 中,rand()已更改,现在只是 mt_rand() 的别名.因此现在也可以使用 rand().

                  Update: In php 7.1 the rand()has been changed and is now merely an alias of mt_rand(). Therefore it is now ok to use rand(), too.

                  这篇关于0 到 1.0 php 之间的随机浮点数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How do I parse XML containing custom namespaces using SimpleXML?(如何使用 SimpleXML 解析包含自定义命名空间的 XML?)
                  SimpleXML SOAP response Namespace issues(SimpleXML SOAP 响应命名空间问题)
                  Problems with PHP namespaces and built-in classes, how to fix?(PHP 命名空间和内置类的问题,如何解决?)
                  Use php namespace inside function(在函数内部使用 php 命名空间)
                  unexpected #39;use#39; (T_USE) when trying to use composer(尝试使用作曲家时意外的“使用(T_USE))
                  PHP adding custom namespace using autoloader from composer(PHP使用来自作曲家的自动加载器添加自定义命名空间)
                    <tbody id='uuHH2'></tbody>
                    <bdo id='uuHH2'></bdo><ul id='uuHH2'></ul>

                    <small id='uuHH2'></small><noframes id='uuHH2'>

                    • <legend id='uuHH2'><style id='uuHH2'><dir id='uuHH2'><q id='uuHH2'></q></dir></style></legend>

                      • <i id='uuHH2'><tr id='uuHH2'><dt id='uuHH2'><q id='uuHH2'><span id='uuHH2'><b id='uuHH2'><form id='uuHH2'><ins id='uuHH2'></ins><ul id='uuHH2'></ul><sub id='uuHH2'></sub></form><legend id='uuHH2'></legend><bdo id='uuHH2'><pre id='uuHH2'><center id='uuHH2'></center></pre></bdo></b><th id='uuHH2'></th></span></q></dt></tr></i><div id='uuHH2'><tfoot id='uuHH2'></tfoot><dl id='uuHH2'><fieldset id='uuHH2'></fieldset></dl></div>

                            <tfoot id='uuHH2'></tfoot>