Libraryless. Click here for Pure Java version (4674L/26K).
1 | static bool tossCoin() { |
2 | ret oneIn(2); |
3 | } |
4 | |
5 | static bool tossCoin(Random random) { |
6 | ret oneIn(2, random); |
7 | } |
8 | |
9 | sbool tossCoin(double probability) { |
10 | ret randomZeroToOneExclusive() < probability; |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1006949 |
Snippet name: | tossCoin |
Eternal ID of this version: | #1006949/3 |
Text MD5: | d2daeccb5f5f4a7b3726cc0c37873a31 |
Transpilation MD5: | 04f63f3d4368619baa0780df8aeee34e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-12-26 16:39:19 |
Source code size: | 205 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 511 / 646 |
Version history: | 2 change(s) |
Referenced in: | [show references] |