@Override
        public void writeTo(final OutputStream out) throws IOException {

            final int blocksize = 2048;
            int remaining = (int) length; // range checked in constructor
            final byte[] data = new byte[Math.min(remaining, blocksize)];

            while (remaining > 0) {
                final int end = Math.min(remaining, data.length);

                double value = 0.0;
                for (int i = 0; i < end; i++) {
                    // we get 5 random characters out of one random value
                    if (i % 5 == 0) {
                        value = Math.random();
                    }
                    value = value * RANGE.length;
                    final int d = (int) value;
                    value = value - d;
                    data[i] = RANGE[d];
                }
                out.write(data, 0, end);
                out.flush();

                remaining = remaining - end;
            }
            out.close();

        }
Generates the random content.

@param out   where to write the content to
httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java