Added check of number of inversions. Also, I lied. No guaranteed generation.