惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Webroot Blog
Webroot Blog
U
Unit 42
A
About on SuperTechFans
宝玉的分享
宝玉的分享
月光博客
月光博客
C
CERT Recently Published Vulnerability Notes
P
Privacy International News Feed
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
P
Privacy & Cybersecurity Law Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Securelist
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Spread Privacy
Spread Privacy
L
Lohrmann on Cybersecurity
Apple Machine Learning Research
Apple Machine Learning Research
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
B
Blog
I
Intezer
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
V
V2EX
L
LangChain Blog
AI
AI
G
GRAHAM CLULEY
T
Tor Project blog
人人都是产品经理
人人都是产品经理
D
Docker
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
I
InfoQ
Y
Y Combinator Blog
C
Comments on: Blog
GbyAI
GbyAI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
N
News and Events Feed by Topic
MyScale Blog
MyScale Blog
H
Help Net Security
Vercel News
Vercel News
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿

博客园 - 郄永军

用触发器实现表的同步操作 Quartz CronTrigger最完整配置说明 - 郄永军 - 博客园 如何优化JAVA程序开发,提高JAVA性能 使用Hibernate+Middlegen实现自动代码生成简介 如何用java调用c++编写成的DLL Web.xml加载顺序 java性能优化 Java NIO简介 选用ibatis和hibernate的区别 Fusioncharts 参数 dwr介绍 ASP.NET缓存:方法分析和实践示例 比较同一数据库不同版本间数据表之间差异 如何动态执行存储过程或函数 NTKO正文控件的使用技巧 - 郄永军 - 博客园 Dorado开发框架下保存附件存草稿功能 - 郄永军 - 博客园 JS中的关于类型转换的性能优化 - 郄永军 - 博客园 如何把ini文件转换为xml 获取文件大小的java程序
生成随即的数值
郄永军 · 2010-12-14 · via 博客园 - 郄永军

代码

 1 Random rand = new Random();
 2 
 3 // Random integers
 4 int i = rand.nextInt();
 5 // Continually call nextInt() for more random integers ...
 6 
 7 // Random integers that range from from 0 to n
 8 int n = 10;
 9 = rand.nextInt(n+1);
10 
11 // Random bytes
12 byte[] bytes = new byte[5];
13 rand.nextBytes(bytes);
14 
15 // Other primitive types
16 boolean b = rand.nextBoolean();
17 long l = rand.nextLong();
18 float f = rand.nextFloat();     // 0.0 <= f < 1.0
19 double d = rand.nextDouble();   // 0.0 <= d < 1.0
20 
21 
22 // Create two random number generators with the same seed
23 long seed = rand.nextLong();
24 rand = new Random(seed);
25 Random rand2 = new Random(seed);
26