Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
#渋谷java あなたと乱数生成とJava
Search
KOMIYA Atsushi
March 07, 2015
Programming
1
1.8k
#渋谷java あなたと乱数生成とJava
第十回 #渋谷java
http://shibuya-java.connpass.com/event/11574/
での発表資料です。Java で乱数生成するときのお話をしました。
KOMIYA Atsushi
March 07, 2015
Tweet
Share
More Decks by KOMIYA Atsushi
See All by KOMIYA Atsushi
#JJUG Java における乱数生成器とのつき合い方
komiya_atsushi
5
5.5k
#JJUG Fork/Join フレームワークを効率的に正しく使いたい
komiya_atsushi
0
540
[#JSUG] SmartNews における container friendly な Spring Boot アプリケーション開発
komiya_atsushi
1
11k
Java のデータ圧縮ライブラリを極める #jjug_ccc #ccc_c7
komiya_atsushi
4
5.2k
#devsumi 自然言語処理・機械学習によるファクトチェック業務の支援
komiya_atsushi
1
4.7k
SmartNews Ads における機械学習の活用とその運用 #mlops
komiya_atsushi
3
20k
GBDT によるクリック率予測を高速化したい #オレシカナイト vol.4
komiya_atsushi
5
1.4k
Maven central repository の artifact をランキングする #渋谷java
komiya_atsushi
0
1.5k
確率的データ構造を Java で扱いたい! #JJUG
komiya_atsushi
6
2.4k
Other Decks in Programming
See All in Programming
ローカルLLMを⽤いてコード補完を⾏う VSCode拡張機能を作ってみた
nearme_tech
PRO
0
240
AIエージェントの設計で注意するべきポイント6選
har1101
6
2.9k
re:Invent 2025 トレンドからみる製品開発への AI Agent 活用
yoskoh
0
570
Patterns of Patterns
denyspoltorak
0
410
ThorVG Viewer In VS Code
nors
0
530
ゲームの物理 剛体編
fadis
0
390
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
470
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
300
ゆくKotlin くるRust
exoego
1
190
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
1.1k
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
700
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
430
Featured
See All Featured
Side Projects
sachag
455
43k
Music & Morning Musume
bryan
46
7k
Speed Design
sergeychernyshev
33
1.5k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
43
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.4k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
2.8k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Un-Boring Meetings
codingconduct
0
170
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
The Pragmatic Product Professional
lauravandoore
37
7.1k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
210
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.5k
Transcript
͋ͳͨͱཚੜͱ Java ୈेճ #ौ୩java 2015-03-07 @komiya_atsushi
͓·ͩΕ ʢ͓લ୭Αʁʣ
,0.*:""UTVTIJ !LPNJZB@BUTVTIJ
None
Ad server and machine learning with Java
Random Number Generator
java.util.Random
None
Random classes provided by JDK
Random classes provided by JDK • java.util.Random • java.security.SecureRandom •
SecureRandom.getInstance("SHA1PRNG") • java.util.concurrent.ThreadLocalRandom • ThreadLocalRandom.current()
Random classes provided by commons-math3
Random classes provided by commons-math3 • MersenneTwister • most popular
(?) random number generator • Well44497a • longer period than Mersenne Twister • ISAACRandom • a fast cryptographic pseudo-random number generator
Random classes provided by commons-math3 • RandomDataGenerator supports sampling from
various distributions • Beta / Binomial / Cauchy / ChiSquare / Exponential / F / Gamma / Hypergeometric / Pascal / Poisson / T / Weibull / Zipf • java.util.Random only supports sampling from Gaussian (normal distribution)
Comparisons
Concurrency of Random and ThreadLocalRandom
Concurrency of Random and ThreadLocalRandom 5ISFBE-PDBM3BOEPNJTBXFTPNF
Latency of 200,000,000 times random number generation
Latency of 200,000,000 times random number generation .FSTFOOF5XJTUFS JTGBTU 3BOEPNJTOPU
GBTU
Conclusion
If you need… • high concurrency one • use ThreadLocalRandom
• very long-period & high quality one • use Well44497a • long-period & fast one • use MersenneTwister • cryptographically secure one • use SecureRandom
Thanks! Any questions?
8&`3&)*3*/( IUUQTKPCTGPSLXFMMDPNTNBSUOFXT PSDPOUBDUNF