Can you help with that definition for a CCA? The following is a definition taken from Introduction to Modern Cryptography by Katz and Lindell.

I'm having a hard time understanding some basic concepts! Can you please help me?
$\newcommand{\Gen}{\operatorname{Gen}}\newcommand{\Enc}{\operatorname{Enc}}
\newcommand{\Dec}{\operatorname{Dec}}$


  Consider the following experiment for any private-key encryption scheme
  $Π=(\Gen,\Enc,\Dec)$, adversary $A$, and value $n$ for the security parameter.
  The CCA indistinguishability experiment PrivK:Aan (n) is:
  
  
  A key $k$ is generated by running $\Gen (1^n)$.
  The adversary $A$ is given input $1^n$ and oracle access to $\Enc_k (&#183;)$
  and $\Dec_k (&#183;) $. It outputs a pair of messages $m_0, m_1$ of the
  same length.
  A random bit $b\in \{0,1\}$ is chosen, and then a ciphertext
  $c = \Enc_k(m_b)$ is computed and given to $A$. We call $c$ the
  challenge ciphertext.
  The adversary $A$ continues to have oracle access to $\Enc_k (&#183;)$ and $\Dec_k (&#183;)$,
  but is not allowed to query the latter on the challenge ciphertext itself.
  Eventually, $A$ outputs a bit $b&#39;$.
  The output of the experiment is defined to be 1 if $b&#39; = b$, and 0 otherwise.
  



In the second bullet point what does "It outputs a pair of messages" mean? Who and where does it output those messages? Does the adversary output the messages? The oracle?
What's the purpose of the random bit b?
In step 2, the adversary outputs two messages. One of these will be selected at random for encryption. You can think of the adversary sending these messages to a "challenger" that also has oracle access (or is the oracle itself). It doesn't really matter who is running the challenge since the challenger doesn't have any "intelligence." All the challenger does is flip a coin to choose a message and remember which message she chose, so she can determine if the adversary guesses correctly or not.

If you think of the adversary as an interactive Turing machine, then the values are put on its output tape (likely why it was phrased that way in the text).

The random bit is just a formalization of flipping an unbias coin. The challenger uses it to pick one of the two messages. If the ciphertext of a given plaintext is indistinguishable from any other ciphertext, then the adversary cannot know which one was chosen any better than predicating the value of the coin flip: which is one half. Therefore, if the adversary can demonstrate the ability to predict better than one half which message was encrypted, it must be the case that the encryption function causes the ciphertexts to leak information about the plaintexts (either by looking at the ciphertext or by submitting related ciphertexts for decryption). In this case, the system is not CCA-secure.