random.next_Java Random next()方法与示例
random.next
随机类的next()方法 (Random Class next() method)
next() method is available in java.util package.
next()方法在java.util包中可用。
next() method is used to return the pseudo-random number in bits.
next()方法用于返回以位为单位的伪随机数。
next() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
next()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
next() method does not throw an exception at the time of returning random bits.
在返回随机位时, next()方法不会引发异常。
Syntax:
句法:
protected int next(int ran_bit);
Parameter(s):
参数:
int ran_bit – represents the random bits (ran_bit).
int ran_bit –表示随机位(ran_bit)。
Return value:
返回值:
The return type of the method is int, it returns the pseudo-random number from this Random generator.
方法的返回类型为int ,它从此Random生成器返回伪随机数。
Example:
例:
// Java program to demonstrate the example
// of int next(int ran_bit) method of
// Random
import java.util.*;
public class NextOfRandom {public static void main(String args[]) {// Instantiates Random object
Random ran = new Random();
// By using next() method is
// to return the next to next
// pseudo-random number
int val = ran.nextInt();
// Display val
System.out.println("ran.nextInt(): " + val);
}
}
Output
输出量
RUN 1:
ran.nextInt(): -1105563452
RUN 2:
ran.nextInt(): -1839120956
RUN 3:
ran.nextInt(): -154633366
翻译自: https://www.includehelp.com/java/random-next-method-with-example.aspx
random.next
random.next_Java Random next()方法与示例相关推荐
- nextgaussian_Java Random nextGaussian()方法与示例
nextgaussian 随机类nextGaussian()方法 (Random Class nextGaussian() method) nextGaussian() method is avail ...
- nextfloat_Java Random nextFloat()方法与示例
nextfloat 随机类nextFloat()方法 (Random Class nextFloat() method) nextFloat() method is available in java ...
- Java Random nextInt()方法与示例
随机类nextInt()方法 (Random Class nextInt() method) Syntax: 句法: public int nextInt(); public int nextInt( ...
- setseed_Java Random setSeed()方法与示例
setseed 随机类setSeed()方法 (Random Class setSeed() method) setSeed() method is available in java.util pa ...
- java nextlong_Java Random nextLong()方法与示例
java nextlong 随机类nextLong()方法 (Random Class nextLong() method) nextLong() method is available in jav ...
- nextboolean()_Java Random nextBoolean()方法与示例
nextboolean() 随机类nextBoolean()方法 (Random Class nextBoolean() method) nextBoolean() method is availab ...
- java node.next_Java Node.nextSibling方法代码示例
import org.jsoup.nodes.Node; //导入方法依赖的package包/类 private void parseObjectives(final Quest quest, fin ...
- python random randint_Python random.randint方法代码示例
本文整理汇总了Python中numpy.random.randint方法的典型用法代码示例.如果您正苦于以下问题:Python random.randint方法的具体用法?Python random. ...
- 获取随机数的方式Random类对象的方法 java 0913
获取随机数的方式Random类对象的方法 java 0913 Random类 实例化这个类得到一个对象 利用对象的方法获取整数 代码 import java.util.Random;public cl ...
最新文章
- 外网远程桌面连接设置
- 多条记录取最近日期的一条_Excel VBA:基于员工打卡记录的考勤数据统计
- MySQL单表数据量过千万,采坑优化记录,完美解决方案
- 微服务实践分享(8) 控制调用中心
- jquery回弹_创意网页DOM元素拖拽弹性反弹和变形动画特效
- Redis数据分布一致性哈希
- JS Math对象(算数、四舍五入、随机数)
- 深度学习(6) - 循环神经网络
- 东软 c语言笔试题,C语言笔试题及参考答案-东软集团(最新整理)
- 二叉树+链表+字符串+栈和队列高频面试题合集
- sql java驱动程序_microsoft sql server jdbc驱动下载
- 《Unsupervised Monocular Depth Learning in Dynamic Scenes》论文笔记
- Python 教程视频汇总
- BasicVSR_pp video2frame
- 电脑右键“打开方式”不见了怎样恢复
- 中基协:推荐使用电子合同
- Oracle 10g 版本10.2.0.1.0升级到Oracle 10g 10.2.0.3.0过程
- W nDOwS多系统安装,IVB新平台Wndows XP系统安装教程.doc
- 高职Java竞赛_2019年全国职业院校技能大赛高职组“物联网技术应用”赛项开赛...
- 脑波扫描器市场现状及未来发展趋势