<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中生成随机正数和负数

        时间:2023-10-14

        <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中生成随机正数和负数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:是否有一种有效的算法用于有限数量的整数分区? 下一篇:在 Java 中将单词转换为数字

                  相关文章

                2. <legend id='7zHsO'><style id='7zHsO'><dir id='7zHsO'><q id='7zHsO'></q></dir></style></legend>

                    • <bdo id='7zHsO'></bdo><ul id='7zHsO'></ul>
                  1. <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>