Chess960 position generator
Ruby 1.9, 67 65 characters
Ah, the old &quot;keep randomizing until you generate something valid&quot; technique...
$_=%w(r r n n b b q k).shuffle*''until/r.*k.*r/&amp;&amp;/b(..)*b/
$&gt;&lt;&lt;$_

(In Ruby 2.0, %w(r r n n b b q k) could be 'rrnnbbqk'.chars)