Equivalent to guava ByteStreams.copy, with one special behavior: if is has no bytes immediately available for
read, the os is flushed prior to the next read that will probably block.
please use JDK java.util.concurrent.ThreadLocalRandom instead.
The JDK implementation uses local fields in the Thread class instead of a classic ThreadLocal,
which makes it faster...