nextfloat

随机类nextFloat()方法 (Random Class nextFloat() method)

  • nextFloat() method is available in java.util package.

    nextFloat()方法在java.util包中可用。

  • nextFloat() method is used to generate the next pseudo-random float value between the range 0.0 and 1.0 from this Random Value Generator.

    nextFloat()方法用于从该随机值生成器生成介于0.0和1.0之间的下一个伪随机浮点值。

  • nextFloat() 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.

    nextFloat()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • nextFloat() method does not throw an exception at the time of returning float.

    返回float时, nextFloat()方法不会引发异常。

Syntax:

句法:

    public float nextFloat();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of the method is float, it returns next pseudo-random distributed float value between the given range from this Random Generator.

方法的返回类型为float ,它从该Random Generator返回给定范围之间的下一个伪随机分布float值。

Example:

例:

// Java program to demonstrate the example
// of float nextFloat() method of
// Random
import java.util.*;
public class NextFloatOfRandom {public static void main(String args[]) {// Instantiates Random object
Random ran = new Random();
// By using nextFloat() method is
// to return float pseudo-random
// value between 0.0 and 1.0 by
// using Random Value Generator
float val = ran.nextFloat();
// Display
System.out.println("ran.nextFloat(): " + val);
}
}

Output

输出量

RUN 1:
ran.nextFloat(): 0.89347947
RUN 2:
ran.nextFloat(): 0.48533785
RUN 3:
ran.nextFloat(): 0.2989604

翻译自: https://www.includehelp.com/java/random-nextfloat-method-with-example.aspx

nextfloat

nextfloat_Java Random nextFloat()方法与示例相关推荐

  1. python random randint_Python random.randint方法代码示例

    本文整理汇总了Python中numpy.random.randint方法的典型用法代码示例.如果您正苦于以下问题:Python random.randint方法的具体用法?Python random. ...

  2. random.next_Java Random next()方法与示例

    random.next 随机类的next()方法 (Random Class next() method) next() method is available in java.util packag ...

  3. python paperclip_Python pyplot.sca方法代码示例

    本文整理汇总了Python中matplotlib.pyplot.sca方法的典型用法代码示例.如果您正苦于以下问题:Python pyplot.sca方法的具体用法?Python pyplot.sca ...

  4. python连接redis哨兵_Python redis.sentinel方法代码示例

    本文整理汇总了Python中redis.sentinel方法的典型用法代码示例.如果您正苦于以下问题:Python redis.sentinel方法的具体用法?Python redis.sentine ...

  5. python类怎么实例化rnn层_Python backend.rnn方法代码示例

    本文整理汇总了Python中keras.backend.rnn方法的典型用法代码示例.如果您正苦于以下问题:Python backend.rnn方法的具体用法?Python backend.rnn怎么 ...

  6. pythoninterp error_Python numpy.interp方法代码示例

    本文整理汇总了Python中numpy.interp方法的典型用法代码示例.如果您正苦于以下问题:Python numpy.interp方法的具体用法?Python numpy.interp怎么用?P ...

  7. python operator __gt___Python operator.gt方法代码示例

    本文整理汇总了Python中operator.gt方法的典型用法代码示例.如果您正苦于以下问题:Python operator.gt方法的具体用法?Python operator.gt怎么用?Pyth ...

  8. python scipy.stats.norm.cdf_Python stats.norm方法代码示例

    本文整理汇总了Python中scipy.stats.norm方法的典型用法代码示例.如果您正苦于以下问题:Python stats.norm方法的具体用法?Python stats.norm怎么用?P ...

  9. python中string.digits_Python string.hexdigits方法代码示例

    本文整理汇总了Python中string.hexdigits方法的典型用法代码示例.如果您正苦于以下问题:Python string.hexdigits方法的具体用法?Python string.he ...

最新文章

  1. Tomcat 1099端口占用重启无效,查不到进程,改换端口无效解决方案
  2. Java线程如何转储
  3. 退出python命令行-在cmd命令行里进入和退出Python程序的方法
  4. 游戏领域Serverless架构探索之路
  5. SDNU 1300.转圈游戏(快速幂)
  6. 在Excel中引用Visual Studio.NET 2008编写的COM组件
  7. CSS3--box-shadow
  8. 【论文分享】ACL 2020 多模态相关任务分享
  9. 面向对象设计模式与原则
  10. studio2.3app签名打包安装失败,找不到签名证书。
  11. visio2016无法安装的完美解决方法
  12. WORD文档编辑锁定
  13. Go语言学习 二十三 错误处理和运行时恐慌(Panic)
  14. R语言-变量命名规则
  15. 如何制作一份优秀的简历?
  16. 移动电信数据仓库设计六环节
  17. CCNP学习之路之AAA详解(authentication、Authorization、Accounting)
  18. 网页设计与网站规划 作业21 圣诞节壁纸制作
  19. Matlab指标权重的确定(AHP标度拓展层次分析法、EVM熵权法和博弈论的结合)
  20. 健身俱乐部管理系统 JAVA MySQL

热门文章

  1. java匿名类和匿名对象及this的其他用法
  2. mysql在哪里写代码_[译] 如何写好 Go 代码
  3. mysql删除盘点表,用友U8数据库表名参照表修改号参考.doc
  4. g标签 怎么设置svg_SVG g元素
  5. linux课堂笔记(8)
  6. django filter查询多选_动态filter查询数据Django实现方法
  7. mysql 导入 mssql_MySQL(csv,text)导入mssql使用方法
  8. MySQL管理工具MySQL Utilities — 如何连接MySQL服务器
  9. LDAP命令介绍---dsreplication--initialize
  10. oracle跨越千年处理