Libraryless. Click here for Pure Java version (8059L/45K).
1 | srecord noeq CheckLSFRTriplet(int bits, int[] triplet) {
|
2 | settable bool verbose; |
3 | |
4 | TripletLSFR lsfr; |
5 | int steps; |
6 | |
7 | bool get() {
|
8 | lsfr = new TripletLSFR(bits, triplet[0], triplet[1], triplet[2]); |
9 | int cycleLength = (1 << bits)-1; |
10 | assertEquals(cycleLength, lsfr.cycleLength()); |
11 | |
12 | new BitSet bs; |
13 | for (steps = 0; steps < cycleLength; steps++) {
|
14 | int i = lsfr.next(); |
15 | if (verbose) print(+i); |
16 | if (i < 1 || i > cycleLength) false; |
17 | if (bs.get(i)) |
18 | false; |
19 | bs.set(i); |
20 | } |
21 | |
22 | true; |
23 | } |
24 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035201 |
| Snippet name: | CheckLSFRTriplet |
| Eternal ID of this version: | #1035201/8 |
| Text MD5: | 11aefffc14631989eb85a9fd6fc8a989 |
| Transpilation MD5: | 576a25dace4e7d229a7577697ef8b2b2 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-04-15 03:11:48 |
| Source code size: | 572 bytes / 24 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 603 / 735 |
| Version history: | 7 change(s) |
| Referenced in: | [show references] |