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

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

      1. <legend id='OUCkH'><style id='OUCkH'><dir id='OUCkH'><q id='OUCkH'></q></dir></style></legend>
      2. <tfoot id='OUCkH'></tfoot>

        如何在Java中生成随机正数和负数

        How to generate random positive and negative numbers in Java(如何在Java中生成随机正数和负数)

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

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

                  <legend id='OAav9'><style id='OAav9'><dir id='OAav9'><q id='OAav9'></q></dir></style></legend>
                1. 本文介绍了如何在Java中生成随机正数和负数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在原始数据类型 short 的范围(-32768、32767)上生成随机整数.java Random 对象只生成正数.我将如何在该间隔上随机创建数字?谢谢.

                  I am trying to generate random integers over the range (-32768, 32767) of the primitive data type short. The java Random object only generates positive numbers. How would I go about randomly creating numbers on that interval? Thanks.

                  推荐答案

                  你随机对 (0, 32767+32768) 然后减去 32768

                  You random on (0, 32767+32768) then subtract by 32768

                  这篇关于如何在Java中生成随机正数和负数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Compiling C++ for the JVM(为 JVM 编译 C++)
                  Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                  How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                  Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                  How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                  Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)
                  <legend id='7zHsO'><style id='7zHsO'><dir id='7zHsO'><q id='7zHsO'></q></dir></style></legend>

                        <tbody id='7zHsO'></tbody>
                        • <bdo id='7zHsO'></bdo><ul id='7zHsO'></ul>
                        • <small id='7zHsO'></small><noframes id='7zHsO'>

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