#!/usr/bin/perl srand(1337); # constant bits, the rest are filled with random data $bits = $ARGV[0] || 10; $rem = 16 - $bits; for ($i = 0; $i < 2**$bits; $i++) { $out = $i * 2**$rem + int(rand(2**$rem)); print $out . ",\n"; }