Download Jar. Libraryless. Click here for Pure Java version (1238L/9K).
!7 static int n = 1000000; p { new SecureRandom sr; new Random r; print("n=" + n); repeat 10 { time "Random" { repeat n { r.nextInt(); } } printBenchResult(n); } repeat 10 { time "Secure Random" { repeat n { sr.nextInt(); } } printBenchResult(n); } }
Began life as a copy of #1010909
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1010910 |
| Snippet name: | Bench SecureRandom vs normal random - ~2 microseconds vs ~200 nanoseconds [OK] |
| Eternal ID of this version: | #1010910/5 |
| Text MD5: | aa72c92370f5b3f436f1eb4b2982694b |
| Transpilation MD5: | f0682494fb0c8b2bbcce20b80cb464a8 |
| Author: | stefan |
| Category: | javax / random |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-09-22 12:35:45 |
| Source code size: | 330 bytes / 23 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 791 / 1746 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |