Class BitSwitcher
java.lang.Object
io.github.olyutorskii.aletojio.shrink.BitSwitcher
- All Implemented Interfaces:
RndInt32
Switch output bits from 2 input streams.
Another stream is required to provide the switching. If switching-bit is 0, output 1st input stream bit. If switching-bit is 1, output 2nd input stream bit.
Random number output throughput decreases 1/3
.
Example
- input stream 1st 01010101
- input stream 2nd 11001100
- switch stream 00001111
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Return next random number as 32bit int with random sign-bit.
-
Constructor Details
-
BitSwitcher
Constructor.- Parameters:
sw
- switch streamrnd0
- input stream 1strnd1
- input stream 2nd- Throws:
NullPointerException
- stream is null
-
-
Method Details