当前位置:网站首页>Math. Usage of random()
Math. Usage of random()
2022-07-21 15:20:00 【Black and white impure】
Math.random()
Function returns a floating point number , Pseudo random numbers in the range from 0 To Less than 1, in other words , from 0( Include 0) Upward , But not including 1( exclude 1).
public class Text2 {
public static void main(String[] args) {
System.out.println(Math.random());
}
}
Math.random()
take [num1,num2) Between int The format of type random number is :
int random= (int)(Math.random()*(num2-num1)+num1)
example : take [10,49) Data between
public class Text2 {
public static void main(String[] args) {
int random= (int)(Math.random()*(49-10)+10);
System.out.println(random);
}
}
边栏推荐
- 项目总结:文件管理系统
- 福昕软件亮相2022年全国化工企业数智化转型发展论坛
- Hangzhou dynamic environment monitoring system supplier, dynamic environment monitoring equipment
- 第二章第十节:列表的补充知识点
- 2.3 分支语句
- DAMA-总结(数据管理的总结)
- Section 15 of Chapter 2: basic operation of dictionary
- VSS中上传一个文件夹(包括子文件夹和文件)
- Section 13 of Chapter 2: intersection of set And Cross set
- 版本号自增
猜你喜欢
【每日一题】1260. 二维网格迁移
(Open Shortest Path First,OSPF)实验4
DAMA-总结(数据管理的总结)
第二章 第五节:查找和判断
openGauss内核分析:查询重写
Spark SQL compilation module - lexical and parser antlr4 (I
Detailed explanation of TCP communication process (with case code)
Web3 Traffic Aggregation Platform Starfish os, Explaining Real Business' p2e 'Ecology
(2022版)零基础入门网络安全/Web安全,收藏这一篇就够了
福昕软件亮相2022年全国化工企业数智化转型发展论坛
随机推荐
第二章第十五节:字典的基本操作
SwiftUI 中使用 SpriteKit 创建雨动画效果(教程含源码)
openGauss内核分析:查询重写
DevExpress TreeList 实现父节点列值选中,其下子节点也全部选中
2.3 分支语句
SQL Server 查询语法汇总
Arm assembly instruction set with examples
第二章第九节:练习答案
Opportunities and challenges coexist for financial enterprises to go to sea in emerging markets, advance AI ensures its safety and compliance development
How to ensure data security while saving 30% disk space in tdsql PG version DB · insight
Section 2 of Chapter 2: string index and slicing
Web3 traffic aggregation platform starfish OS gives players a new paradigm experience of metauniverse
The relationship between data warehouse and data center
Starfish OS:以现实为纽带,打造元宇宙新范式
金融场景下,分布式数据库如何精准选型和快速落地?
asp. Net - edit hyperlink event
Networkx visualization graph how to get a graph based on time series
第二章 第十四节:字典的概念
Devaxpress xtrareport report development related knowledge points
金融企业出海新兴市场机遇与挑战并存,ADVANCE.AI保障其安全合规发展