#!/usr/bin/ruby -w # Generate binary data with repeating blocks that are near the size of # our maximum match length. # Set fixed seed for deterministic output. srand(1) # Generate a block all unique bytes. base_block = (0..255).to_a # Double this block so that we can slice more than 256 elements from it. base_block += base_block # Generate random blocks of varying lengths that can't be compressed, # and output each block a few times. (252..258).each{|s| print base_block.shuffle[0..s].map{|c| c.chr}.join("") * 3 } # Generate a set of short random blocks. blocks = [] (49..53).each{|s| blocks += [base_block.shuffle[0..s].map{|c| c.chr}.join("")] } # Output all block permutations. blocks.permutation.each{|p| print p.join("") }