Libraryless. Click here for Pure Java version (4674L/26K).
static bool tossCoin() { ret oneIn(2); } static bool tossCoin(Random random) { ret oneIn(2, random); } sbool tossCoin(double probability) { ret randomZeroToOneExclusive() < probability; }
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: | 509 / 642 |
Version history: | 2 change(s) |
Referenced in: | [show references] |