Libraryless. Click here for Pure Java version (4698L/26K).
static int[] arrayOfRandomBitsAsInts(int n, double probability) { int[] data = new[n]; int nBits = n*4; for i to nBits: if (tossCoin(probability)) setBitInIntArray_littleEndian(data, i); ret data; }
Began life as a copy of #1033662
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033665 |
| Snippet name: | arrayOfRandomBitsAsInts |
| Eternal ID of this version: | #1033665/1 |
| Text MD5: | 9c795247647713c5ac7b4229b9fc6686 |
| Transpilation MD5: | 8f2643f05854053916442fc386d2dede |
| 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:40:56 |
| Source code size: | 211 bytes / 6 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 445 / 552 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |