Distinguishing attack on stream cipher created from a block cipher in counter mode A block cipher in counter mode creates a key stream by:

$$z_i = E_K(IV || i)$$

Where $IV$ is some chosen initialisation vector (with some length $l$ less that $n$ bits) and $i$ is the binary representation of the number $i$ in $n-l$ bits. The keystream is then $z_1 || z_2 || z_3 || \cdot \cdot \cdot$

How can we distinguish between such a key stream and a truly random bit sequence?
For a truly random stream, since there are $2^n$ possible $n$-bit blocks, we expect a repeated n-bit block after looking at (roughly) the first $2^{n/2}$ blocks, by the birthday paradox argument. 

For the stream generated by this block cipher, provided that each input block is distinct (i.e. the counter does not start repeating) , the output blocks are distinct (since the block cipher is a permutation). So choosing the IV length small enough (or indeed taking the whole block for the counter and not using an IV), we are guaranteed that no block is repeated for the first $2^k$ blocks, where $k \leq n$ is the length of the counter. 

This way, provided $k$ is large enough, we can distinguish between two such streams by searching for a repeated block.