in reply to Re^3: Data compression by 50% + : is it possible?
in thread Data compression by 50% + : is it possible?
There are remarkably fewer combinations than it would appear at first glance. The OP creates a vector of four random digits (0..9), but then enforces a few rules:
- The four digits are sorted: This reduces 10,000 input vectors to 715 possible outputs.
- Then the code eliminates duplicate values and sequential values reducing the 715 inputs to 102 outputs.
- Then the first value is removed from the list reducing the possible outputs to 50.
As a result of those rules, none of the output groups will contain 0 or 1. So with the OPs script, you should never see the characters:
$ perl -e 'print join(" ", map { chr(33+$_), chr(33+$_+1) } map {10*$_ +} 0 .. 8)' ! " + , 5 6 ? @ I J S T ] ^ g h q r
That removes 18 of the 90 values, greatly reducing the number of possible records generated. Additionally, the remaining digits aren't equally distributed: 2 appears about half as often as 3 and about a third as often as 9.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom